Jel
Jel

Reputation: 564

Identifying UIStoryboard objects without Outlets

Is there a way to reference an object in my UIStoryboard without creating an outlet nor a class for it?

For example, I have a TableViewController with a tableview that I am attempting to put multiple prototype cells into. Inside those cells I am putting multiple labels. I would like to simply name these cells and labels inside the storyboard, but there seems to be no place to do this for the cells (I am used to working in Xamarin, where this was possible).

Is the best solution to this to create a separate class for each of my cells? It seems excessive for the small amount of work I plan on doing with each one.

Upvotes: 0

Views: 43

Answers (1)

vadian
vadian

Reputation: 285190

It's always worth it to create custom classes even for a small amount of work.

A common alternative is to assign tags to the UI elements.
You can identify them by calling viewWithTag: and casting the type respectively.

Upvotes: 1

Related Questions