iphone - 如何在我的方法中获取 objectAtIndex?

标签 iphone ios

如何在我的方法中获取 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/

相关文章:

ios - 同时更新两个 UILabel

ios - 使用多个图像创建自定义 UIButton 并移动 Label 并可能添加属性

iphone - iOS 文件路径上的/private 前缀表示什么?

iphone - iOS 4.3状态栏中的透明png不透明

iphone - 如何在SDK模拟器中模拟iPhone应用升级过程

iOS 构建匹配配置文件错误 - phonegap

iphone - 检测触摸 Cocos2d-x

ios - 如何相互访问我自己的 2 个 iOS 应用程序数据库

iphone - 离开页面后TableViewCells被删除

ios - 在 UITabBar 下方获取输入