두 개의 테이블 (셀 식별자 : 호출 및 셀 식별자 : 셀 2)이 있습니다. 두 테이블 (각 테이블에 대해 하나씩) 개체의 두 배열을 전달 해요 그러나 내 tableView 내 두 번째 테이블에이 작업을 수행 할 때 내 첫 번째 테이블 및 두 번째 배열의 데이터가 아닌 동일한 데이터를 가져 오는 것입니다. 내 배열은 내 .h 파일에서 NSMutableArray로 전역 적으로 설정됩니다. 그것은 첫째 return cell;
라인과 결코에 도달 할 때까지Objective C의 두 번째 테이블 채우기
작성된 코드, 간단하게 실행됩니다 :
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(!cell)
{
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// NSString *currDate = [[array objectAtIndex:indexPath.row] objectForKey:@"Current Date"]; //added
// NSString *someOtherKey = [[array objectAtIndex:indexPath.row] objectForKey:@"Some other key"]; //added
cell.textLabel.text = [array objectAtIndex:indexPath.row];
label1.text = [arrayDate1 objectAtIndex:indexPath.row];
label2.text = [arrayDate2 objectAtIndex:indexPath.row];
// cell.textLabel.text = [NSString stringWithFormat:@"%@ %@", currDate, someOtherKey]; //added
return cell;
//This will Load the second table (myTableView2)
static NSString *CellIdentifier2 = @"Cell2";
UITableViewCell *cell2 = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2];
if(!cell2)
{
cell2 = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier2];
}
// NSString *currDate = [[array objectAtIndex:indexPath.row] objectForKey:@"Current Date"]; //added
// NSString *someOtherKey = [[array objectAtIndex:indexPath.row] objectForKey:@"Some other key"]; //added
cell2.textLabel.text = [array2 objectAtIndex:indexPath.row];
return cell2;
}
당신은 아래 코드는 실행되지 않습니다 처음 돌아 왔을 때. –
두 번째 위의 첫 번째 수익을 이동하면 동일한 결과가 나타납니다. 어떻게 해결할 수 있습니까? – user1832095