【问题标题】:Get row from indexPath in RoboVM从 RoboVM 中的 indexPath 获取行
【发布时间】:2014-05-10 04:34:10
【问题描述】:

我正在尝试在 robovm 中编写以下 Objective-c 代码:

   (NSIndexPath *)indexPath = ...;
   cell.textLabel.text = [tableData objectAtIndex:indexPath.row];

但是,当我在这里查看 RoboVM 对 NSIndexPath 的调用时:
https://github.com/robovm/robovm/blob/e60579613140f4a6d48f108042633fbf17b9c289/cocoatouch/src/main/java/org/robovm/apple/foundation/NSIndexPath.java

或者通过滚动 Eclipse 的选项,我看不到任何与行相对应的内容。我能做什么?

【问题讨论】:

    标签: objective-c nsindexpath robovm


    【解决方案1】:

    我没有使用 RoboVM 的经验。但是,indexPath.sectionindexPath.row 只是方便的方法/属性,用于

    [indexPath indexAtPosition:0] // section
    [indexPath indexAtPosition:1] // row
    

    indexAtPosition:方法在Java类中定义的。

    【讨论】:

    • 谢谢!我试过这个,但没有意识到位置 0 是部分而不是行,所以我认为它不起作用,因为我只有一个部分。感谢您解决这个问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-04
    • 1970-01-01
    • 2013-03-20
    • 2023-03-19
    • 1970-01-01
    • 2014-11-10
    相关资源
    最近更新 更多