0

I guess this again quite basic, but how do I access an object in an array which belongs to a class?

My class is called NoteBook. In this NoteBook I have an array called tabReference. Imagine I have four objects in this array and would like to access the first at index 0.

I tried

int k = 0;    
currentNoteBook.tabReference[objectAtIndex:k];

but xCode tells me that objectAtIndex is undeclared. What would be the correct call?

2 Answers 2

3

the correct way to access an array member in objective c for your example would be:

[currentNoteBook.tabReference objectAtIndex:k];
Sign up to request clarification or add additional context in comments.

Comments

0

And if you want access to the object in the class so can also do like this :

[self.tabReference objectAtIndex:k];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.