定位的iOS 5.0我看到SIGABRT當我嘗試訪問NSIndexPath對象的行或部分的屬性在以下代碼:nsindexpath訪問行到section屬性導致SIGABRT?
NSIndexPath* path = [[NSIndexPath alloc] initWithIndex:0];
int row = path.row; //SIGABRT
int section = path.section;//SIGABRT
這個例子表明使用indexPathWithIndex:代替http://developer.apple.com/library/mac/#samplecode/SourceView/Listings/BaseNode_m.html#//apple_ref/doc/uid/DTS10004441-BaseNode_m-DontLinkElementID_6
path = [NSIndexPath indexPathWithIndex:0];
結果保持是一致的。有沒有人有解釋爲什麼會發生這種情況?是不是我們無法在iOS 5.0中使用NSIndexPath?
謝謝先進。
謝謝。抱歉:我通過課程參考第一次錯過了這個筆記。任何想法他們爲什麼不在類方法下列出這個方法? – stephen
這是因爲這些方法被定義爲NSIndexPath上的一個類別,而不是NSIndexPath類本身。你可以在這裏找到文檔:http://developer.apple.com/library/ios/#documentation/uikit/reference/NSIndexPath_UIKitAdditions/Reference/Reference.html –