I have added prototype cell in one of the controllers that is part of the storyboard I'm designing. It has various labels, buttons, bells and whistles.
But how do I know create outlets to that cell's elements? If I click the assistant in Xcode, it will show me the dummy source of my inherited UITableViewController and not of the "DetailsCell
" which inherits from UITableViewCell
and is specified in the custom class input field in IB.
I could of course use ViewWithTag()
but I'd rather have something strong typed.
With any object you can create with IB, you can assign it to a different class (one that you wrote). This is not different for cells. In the same way you can make IB instantiate MyFooView instead of UIView (MyFooView being derived from UIView), you can do the same for the cells.
Click your cell, click the 3rd icon on the shelf to the right. You will see a section called "Custom Class" and a text field called Class. Select the new class you've just created that is derived from UITableViewCell (let's call it MyCell). You can add IBOutlets to the MyCell class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With