定位的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 –