mardi 4 août 2015

How to use indexPathForItemAtPoint in TableViewController?

I'm using PFQueryTableViewController and in my PFQTVC.m, I've implemented scrollViewDidScroll method so I can get the indexPath of the visible cell when scrolling.

However, I get NO VISIBLE INTERFACE FOR 'PFQTVC' DECLARES THE SELECTOR 'INDEXPATHFORITEMATPOINT'.

UITableViewDataSource and UITableViewDelegate have been added.

What to do?

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
NSLog(@"Did Scroll");

CGRect visibleRect = (CGRect){.origin = self.tableView.contentOffset, .size = self.view.bounds.size};
CGPoint visiblePoint = CGPointMake(CGRectGetMidX(visibleRect), CGRectGetMidY(visibleRect));
NSIndexPath *visibleIndexPath = [self indexPathForItemAtPoint:visiblePoint];

NSLog(@"visible Index Path : %@", visibleIndexPath);

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire