Iphone 如何将nsindepath转换为NSInteger?

Iphone 如何将nsindepath转换为NSInteger?,iphone,objective-c,nsindexpath,nsinteger,Iphone,Objective C,Nsindexpath,Nsinteger,我已经搜索并找到了这个问题以前的答案。问题是,标记为解决方案的答案不起作用。在我的tableView:didSelectRowAtIndexPath:method中,我有 NSInteger *currentRow = indexPath.row; 它给了我一个警告“不兼容的整数到指针转换正在初始化'NSInteger*'(又称'int*'),并使用'NSInteger'(又称'int')类型的表达式 感谢您的帮助 NSInteger不是一个类,因此它不需要星号: NSInteger curr

我已经搜索并找到了这个问题以前的答案。问题是,标记为解决方案的答案不起作用。在我的tableView:didSelectRowAtIndexPath:method中,我有

NSInteger *currentRow = indexPath.row;
它给了我一个警告“不兼容的整数到指针转换正在初始化'NSInteger*'(又称'int*'),并使用'NSInteger'(又称'int')类型的表达式


感谢您的帮助

NSInteger不是一个类,因此它不需要星号:

NSInteger currentRow = indexPath.row;

通过将index.row分配给yourView.tag或yourLabel.tag来跟踪它也是非常有用的,这样您就可以从自定义单元格等中访问信息了……因此它应该是yourTextView.tag=indexPath.row