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 に答える