开发者

How to access an array in an array

I was wondering how to access an array in an array.

This works with a string in an array:

NSLog(@"titleName:%@", [[self.myLibrary objectAtIndex:0] titleName]);

That is, I have an array myLibrary in which I store different classes, each of which has a string for a titleName. In each class I also have arrays and I was wondering how to get access to tho开发者_JAVA百科se arrays. I tried this, but it won't compile as xCode tells me I'm missing an ]:

NSLog(@"titleName:%@", [[self.myLibrary objectAtIndex:self.currentNoteBookNumber] tabReference objectAtIndex:tid]);

Sorry if this is basic, but I'd appreciate your suggestions.


Mr Xcode is right. You missed out the bracket after tabReference.

NSLog(@"titleName:%@", [[[self.myLibrary objectAtIndex:self.currentNoteBookNumber] tabReference] objectAtIndex:tid]);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜