iphone - 如何将 NSIndexPath 转换为 NSInteger?

标签 iphone objective-c nsindexpath nsinteger

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

NSInteger *currentRow = indexPath.row;

它给了我警告'Incompatible integer to pointer conversion initializing 'NSInteger *'(aka 'int *') with an expression of type 'NSInteger' (aka 'int').

感谢任何帮助!

最佳答案

NSInteger 不是一个类,所以它不需要星号:

NSInteger currentRow = indexPath.row;

关于iphone - 如何将 NSIndexPath 转换为 NSInteger?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8550237/

相关文章:

ios - swift : Cast from NSArray to unrelated type NSIndexPath Always fails

iphone - 成为FirstResponder:自动滚动到成为第一响应者的UIControl

iphone - 检测 iPad 键盘隐藏与外部键盘连接?

ios - iBeacon监控无法正常工作

ios - 当 UICollectionView 最初加载其数据时,我们如何获得可见的 Cell IndexPath

ios - Swift 3 - 类型 'Any' 没有下标成员

iphone - 如何应用多个应用程序更新?

iphone - 浏览 iphone 上的文件以获取崩溃日志

iOS - UICollectionView 设置为 0 后单元格之间仍然有间距

ios - CocoaPod 的类别在运行时不可用