cellForRowAtIndexPath 方法不能正常加载的问题
首先借鉴了前辈们的结论:
tableView的另一个方法结果返回不正确:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
但是我查了一下,我的这个numberOfRowsInSection方法能正常加载,但是此时打印出的存放section的数组arrayOfSection的count为0.
后来发现是arrayOfSections没有初始化的原因,java转c真不习惯啊
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self=[super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if(self!=nil)
{
arrayOfSections=[[NSMutableArray alloc] init];//问题所在
for (int i=1; i<=3; i++) {
[self.arrayOfSectionsaddObject:[selfnewSectionWithIndex:i withCellCount:i+2]];
}
}
returnself;
}
浙公网安备 33010602011771号