如何在我的方法中获取objectAtIndex
。
例如,如果我使用didSelectRowAtIndexPath:(NSIndexPath *)indexPath
我可以拿到
NSLog(@"%@", [currentCourses objectAtIndex:indexPath.row]);
我如何在其他这样的方法中做同样的事情?
-(void)longPress : (UILongPressGestureRecognizer *)rec {
if (rec.state == UIGestureRecognizerStateBegan) {
// NSIndexPath *myPath = [NSIndexPath indexPathForRow:0 inSection:0];
/*NSArray *currentCourses = [self currentCourses:myIP0.section];
billContent *bc = [currentCourses objectAtIndex:myIP0.section];
NSLog(@"title - %@", bc.billTitle);*/
// NSLog(@"%@", myPath.row);
//NSLog(@"did selected - %d", indexPath.row);
}
}
最佳答案
-(void)longPress : (UILongPressGestureRecognizer *)rec {
CGPoint swipeLocation = [rec locationInView:self.tableView];
NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:swipeLocation];
UITableViewCell *swipedCell = [self.tableView cellForRowAtIndexPath:swipedIndexPath];
}
关于iphone - 如何在我的方法中获取objectAtIndex?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13265744/