如何将 NSIndexPath 转换为 NSInteger?

发布于 2024-12-22 06:10:45 字数 383 浏览 4 评论 0原文

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

NSInteger *currentRow = indexPath.row;

,它给了我警告“使用‘NSInteger’(又名‘int’)类型的表达式初始化‘NSInteger *’(又名‘int *’)时,整数到指针转换不兼容。”

任何帮助表示赞赏!

I have searched and found a previous answer for this question here. The problem is that the answer marked as a solution does not work. Inside my tableView:didSelectRowAtIndexPath: method, I have

NSInteger *currentRow = indexPath.row;

and it gives me the warning 'Incompatible integer to pointer conversion initializing 'NSInteger *'(aka 'int *') with an expression of type 'NSInteger' (aka 'int').

Any help is appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

筑梦 2024-12-29 06:10:45

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

NSInteger currentRow = indexPath.row;

NSInteger is not a class, so it doesn't need an asterisk:

NSInteger currentRow = indexPath.row;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文