- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSLog(@"Test1");
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//#warning Incomplete method implementation.
// Return the number of rows in the section.
NSLog(@"No. of sections- %d",section);
return [[[BNRItemStore sharedStore] allItems] count] ;//no. of rows
}
在上述场景中,numberOfSectionsInTableView:方法在调用 tableView 方法之前被调用了两次。我不明白为什么。
让我感到困惑的另一件事是,当我以方法1中的部分数量返回时numberOfSectionsInTableView:,为什么它没有反映在- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section方法中?它宁愿将其记录为0.
1自从我像以前一样设置后,section 参数不会更新吗?我的意思是在运行时该tableView:numberOfRowsInSection:方法是在内部调用的,所以显然section参数应该保持一些值。
不是这样吗?