New Objective-C programmer here working on my first app! Sorry in advance.
So it's easy if I have a XIB + View Controller, because I wire up the interface to outlets/ibactions in the view controller and can instantiate a View Controller and get a View with it.
But what about when I just want a view?
Here's what I have:
I have a UITableViewController subclass, and a HeaderView.xib that contains a small UIView that contains a UILabel and an image view.
I want to have every section header use HeaderView.xib.
I implemented the delegate method tableView:viewForHeaderInSection:, and I used:
[[[NSBundle mainBundle] loadNibNamed
"HeaderView" owner:self options:nil] firstObject]
to get the view.
But once I get HeaderView.xib as a view in this manner, how do I access its UILabel and image view for this instance?
I can't exactly just wire up an IBOutlet to the UITableViewController- I'm going to be instantiating multiple. How do I use xib files in this manner?
NOTE: As a temporary workaround I have implemented this part of the app in code, but I much, much prefer to do Autolayout in Interface Builder so I'd rather learn to do this with the tools I'm more proficient in than do it sloppily because I can't figure it out.
So it's easy if I have a XIB + View Controller, because I wire up the interface to outlets/ibactions in the view controller and can instantiate a View Controller and get a View with it.
But what about when I just want a view?
Here's what I have:
I have a UITableViewController subclass, and a HeaderView.xib that contains a small UIView that contains a UILabel and an image view.
I want to have every section header use HeaderView.xib.
I implemented the delegate method tableView:viewForHeaderInSection:, and I used:
[[[NSBundle mainBundle] loadNibNamed
to get the view.
But once I get HeaderView.xib as a view in this manner, how do I access its UILabel and image view for this instance?
I can't exactly just wire up an IBOutlet to the UITableViewController- I'm going to be instantiating multiple. How do I use xib files in this manner?
NOTE: As a temporary workaround I have implemented this part of the app in code, but I much, much prefer to do Autolayout in Interface Builder so I'd rather learn to do this with the tools I'm more proficient in than do it sloppily because I can't figure it out.