2012-06-29 6 views
1

섹션의 셀 행을 확장하는 코드 스 니펫이 있습니다. 코드UITableView 확장 섹션 생성 된 오류

-(void)sectionHeaderView:(SectionHeaderView*)sectionHeaderView sectionOpened:(NSInteger)sectionOpened { 


SectionInfo *sectionInfo = [self.sectionInfoArray objectAtIndex:sectionOpened]; 

sectionInfo.open = YES; 



    NSInteger countOfRowsToInsert = 5;   
NSMutableArray *indexPathsToInsert = [[NSMutableArray alloc] init]; 
for (NSInteger i = 0; i < countOfRowsToInsert; i++) { 
    [indexPathsToInsert addObject:[NSIndexPath indexPathForRow:i inSection:sectionOpened]]; 
} 


NSMutableArray *indexPathsToDelete = [[NSMutableArray alloc] init]; 

NSInteger previousOpenSectionIndex = self.openSectionIndex; 
if (previousOpenSectionIndex != NSNotFound) { 

    SectionInfo *previousOpenSection = [self.sectionInfoArray objectAtIndex:previousOpenSectionIndex]; 
    previousOpenSection.open = NO; 
    [previousOpenSection.headerView toggleOpenWithUserAction:NO]; 
    NSInteger countOfRowsToDelete = 5;  

    for (NSInteger i = 0; i < countOfRowsToDelete; i++) { 
     [indexPathsToDelete addObject:[NSIndexPath indexPathForRow:i inSection:previousOpenSectionIndex]]; 
    } 
} 

// Style the animation so that there's a smooth flow in either direction. 
UITableViewRowAnimation insertAnimation; 
UITableViewRowAnimation deleteAnimation; 
if (previousOpenSectionIndex == NSNotFound || sectionOpened < previousOpenSectionIndex) { 
    insertAnimation = UITableViewRowAnimationTop; 
    deleteAnimation =UITableViewRowAnimationBottom; 
} 
else { 
    insertAnimation = UITableViewRowAnimationBottom; 
    deleteAnimation = UITableViewRowAnimationTop; 
} 

// Apply the updates. 
[xtable beginUpdates]; 
[xtable insertRowsAtIndexPaths:indexPathsToInsert withRowAnimation:insertAnimation]; 


[xtable deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:deleteAnimation]; 
[xtable endUpdates]; 
self.openSectionIndex = sectionOpened; 

}의

니핏

오류는 xtable 업데이트 [: indexPath : endRect : endAlpha : startFraction : endFraction : 곡선 : animateFromCurrentPosition : shouldDeleteAfterAnimation : 편집 UIViewAnimation initWithView]에서 발생

무엇이 잘못되었을 수 있습니까? 어떤 아이디어? 내 경우에는

답변

0

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 
return 0; 
} 
도움