سؤال

How can I make than some method fires then I scroll to half of dataSource array in tableView?

I want to make infinite scroll like this

هل كانت مفيدة؟

المحلول

Use UITableviewDelegate method willDisplayCell: forRowAtIndexPath: and check indexPath.row with dataSource array then fire the method.

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {

     if ([dataSourceArray count]/2 == indexPath.row) {
         //invoke the method here
     }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top