0

So I have an array with objects which each have several attributes including an image, title, subtitle, etc. I would like to put each object into a cell. I know I will have to format the cells to contain all the different attributes, but for starters, how could I put just the title of each object into the cell. If I had just a string array of titles it would be as easy as doing this inside the cellForRowAtIndexPath method:

cell.textLabel.text = [myTitlesArray objectAtIndex:indexPath.row];

but since it's an object array how do I do this?

I've tried:

cell.textLabel.text = [myObjectsArray.title objectAtIndex:indexPath.row];

... and several other placements of .title which is probably ridiculous to even try. Is there a way to do this without making splitting each object into separate arrays of attributes or something hacky like that?

1 Answer 1

1

you probably need to do it this way:

cell.textLabel.text = [[myObjectsArray objectAtIndex:indexPath.row] title];
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! That's exactly right, sorry for the dumb question.

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.