cory ginsberg
cory ginsberg

Reputation: 2897

How to identify UITableView rows in Storyboard?

I used to be able to use UITableViewCells, edit those as I wanted, link them to the .h file, then all I would need to do is call them in code. But now, how would I declare a cell built in the table in storyboard that needs to be called in code?

Upvotes: 0

Views: 144

Answers (1)

Kent
Kent

Reputation: 1689

Select the cell you are interested in and display the Attributes inspector. There is a field named Identifier. Put a unique string like "CellSpecial" in this field.

Then in cellForRowAtIndexPath: load the cell like this:

UITableViewCell *pCell = [tableView dequeueReusableCellWithIdenitifier: @"CellSpecial"];

And if you are creating these cells dynamically (ie, the cell order of the executing application is different than that of the storyboard), then you must go to the TableView in Storyboard and set the Content attribute to Dynamic Prototypes (not Static Content).

Upvotes: 1

Related Questions