0

我怎样才能进入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);

}
}
4

1 回答 1

3
-(void)longPress : (UILongPressGestureRecognizer *)rec {
CGPoint swipeLocation = [rec locationInView:self.tableView];
NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:swipeLocation];
UITableViewCell *swipedCell = [self.tableView cellForRowAtIndexPath:swipedIndexPath];
}
于 2012-11-07T08:36:32.563 回答