[IOS]tableview----NSIndexPath

NSIndexPath用途比较多,通过它可以获得tableview的具体哪一行。以及有不少API都需要传入它。

NSIndexPath *temp = [NSIndexPath indexPathForRow:_selectRow inSection:0];

 通过这个方法,可以通过传入具体行,从而获得该行的NSIndexPath。

UITableViewCell *checkCell = [tableView cellForRowAtIndexPath:temp];

这样就可以获得该行(_selectRow)的cell

NSIndexPath *myIndex = [_wifi_detali_tableView indexPathForCell:(UITableViewCell*)fooCell];

 这样可以通过传入一个cell来获得该cell所在的行的NSIndexPath。

猜你喜欢

转载自jameskaron.iteye.com/blog/2404710