In my implementation of SomeTableViewController, the number of items to show matches the number of sections. So turns out, one row per section (this is because I intend to use the SectionHeaderView of each section).
Note that UITableViewController, by itself, conforms to UITableViewDelegate.
SomeTableViewController.h
...
@interface SomeTableViewController : UITableViewController {
NSMutableArray * _tableViewData;
}
@end
...
@interface SomeTableViewController : UITableViewController {
NSMutableArray * _tableViewData;
}
@end
...
SomeTableViewController.m
...
#pragma mark -
#pragma mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
// If last section is about to be shown...
if ([indexPath section] == [_tableViewData count] - 1) {
NSLog(@"...start fetching more items.");
}
}
...
#pragma mark -
#pragma mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
// If last section is about to be shown...
if ([indexPath section] == [_tableViewData count] - 1) {
NSLog(@"...start fetching more items.");
}
}
...
1 comments :
Use this instead to get rid of your mutable array.
if ((indexPath.section == [self.tableView numberOfSections] - 1) && (indexPath.row == [self.tableView numberOfRowsInSection:indexPath.section] - 1))
Post a Comment
Hi there! Please leave your message here. Also, I may not be able to respond to your query right away. So please bear with me. Thanks. :)