내 코드입니다가 [__NSArrayM objectAtIndex이 :] : 범위를 넘는 인덱스 1 [0 .. 0] 다음은
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
if (indexPath.row >= [CatArray count])
{
return nil;
}
if(searching)
{
cell.textLabel.text=[ListOfArray objectAtIndex:indexPath.row];
}
else
{
NSString *cellv=[CatArray objectAtIndex:indexPath.row];
cell.textLabel.text=cellv;
}
return cell;
}
내가 색인 그것은 잘 작동 0에서 개체를 클릭 만하면 인덱스 1을 클릭하고 내 프로그램 표시 위의 [__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]
오류. 이 오류를 수정하는 방법을 찾을 수 없습니다.
도와주세요.
당신이 당신에 기록 된 것을 보여주십시오 'didSelectRowAtIndexPath ...' –
당신의 CatArray 인덱스에 하나의 개체있다 - 0 점검 indexpath.row = 1 음역 0 인덱스 1 개체가있다. .0 또는 didSelectRowAtIndexPath를 사용하면 atIndex 객체가없는 다른 Array로 작업 할 수 있습니다. 1 – Nazir
@zaph, 두 개의 배열이 있음을 알 수 있습니다. 범위 중 하나에서 경계가 검사되지만 검색중인 객체에서는 경계가 검사되지 않습니다. 디버그를 시도하는 경우 –