2012-08-16 3 views
0

iOS Projetct에서 UItableView를 재미있게 사용하고 있지만 정상적으로 작동하지만 충돌시 음성을 켜면이 코드가 null 셀을 반환하는 것으로 보입니다. 당신이 내 코드와 함께 문제를 볼 수 있습니까 :음성 해설시 크래시 테이블보기

-(UITableViewCell*) cellForIndexPath:(NSIndexPath*) indexPath inTableView:(UITableView*) tableView { 
    static NSString *CellIdentifier = @"TocCellView"; 
    UITableViewCell* cell =(UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) { 
     // Use apple technic explained here : http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html 

     [[NSBundle mainBundle] loadNibNamed:@"TocCellView" owner:self options:nil]; 


     cell = self.tableViewCell; 
     cell.layer.masksToBounds = YES; 
    } 

    if ([GraphicHelper isiPad]) { 
     [self fillIPadCell:cell withBookPage:[self pageCorrespondingToIndex:indexPath] section:indexPath.section]; 
    } 
    else { 
     BOOL isEvenCell = (indexPath.row%2); 
     BOOL isEvenHeader = (indexPath.section%2); 
     [self fillIPhoneCell:cell withBookPage:[self pageCorrespondingToIndex:indexPath] forEvenCell:isEvenCell inEvenHeader:isEvenHeader];   
    } 
    return cell; 
} 

답변

0

을이 줄에 중단 점을 넣어해야합니다로드 할 수 없습니다

cell.layer.masksToBounds = YES; 

가 null의 경우는 아마 당신의 NIB을 의미 셀 경우와 NIB에 대한 잘못된 이름처럼 간단 할 수도 있고 Interface Builder에서 적절한 연결을 만들지 못했을 수도 있습니다.

+0

답장을 보내 주셔서 감사합니다.하지만 문제는 내가 음성을 활성화하지 않았을 때 충돌이없고 작동하는 것입니다. – samir

+0

당신은 NULL 셀이 반환 된 결과로 충돌이 발생했다고 말했고, 실제로 그렇다면 이미 검색 범위를 좁혔습니다. 지금 현재 로선 문제가 셀에 대기 중인지 또는 펜촉에서로드되었는지 여부는 알 수 없습니다. – Brian