2010-09-14 55 views
11

任何人都可以指向我在[indexPath行]在文檔中描述的位置,我已經看過NSIndexPath,但我找不到任何提及的「行」?我假設它是一個NSUInteger,但我也想仔細檢查它的類型,看看還有哪些其他屬性可用。[NSIndexPath行]記錄在哪裏?

實施例:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    NSUInteger currentRow = [indexPath row]; 
} 

歡呼加里

+1

非常感謝所有的答案,非常感謝。 – fuzzygoat 2010-09-14 13:25:04

回答

21

.row屬性是UIKit中定義的擴展類的一部分。

該文檔位於https://developer.apple.com/reference/foundation/nsindexpath/1614853-row(行)和https://developer.apple.com/reference/foundation/nsindexpath/1528298-section(部分)。

索引號識別在表視圖的截面的行。 (只讀)

@property(readonly) NSUInteger row 

討論

的部分中的行是在通過的section的值來標識。


的夫特對應物:https://developer.apple.com/reference/foundation/indexpath/1779554-row(行)和https://developer.apple.com/reference/foundation/indexpath/1779112-section(部分)。

這些Swift屬性的類型爲Int

+0

救了我的命。突然.row,.section不可用。 – 2017-03-02 04:58:29

1

這是一個UIKit的補充,記錄separately。你是正確的,它是一個NSUInteger

+1

是的,由於某些原因,那些UIKit新增的文檔真的很難找到。我一直在尋找字符串圖紙尺寸方法的確切拼寫。 Xcode不會自動完成它們,它總是需要我去尋找那個幫助文檔。 – 2010-09-14 12:00:57