I’m not instantiating my controls/views manually. I’ve set up a storyboard like this:
-> UITabBarController-> UINavigationController-> HomeViewController
I switched the controller class of the last to my own HomeViewController.
Here’s the code:
@interface HomeViewController : UIViewController {
UIView *buttonView;
UITableView *buttonTableView;
}
@property (nonatomic, retain) IBOutlet UIView *buttonView;
@implementation HomeViewController
@synthesize buttonView;
Inside the main view for HomeViewController there’s a subview (UIView) that is hooked up to the outlet by ctrl-dragging one of those lines.
But I can’t for my life find a method on UIViewController to override that will be invoked somewhere in the life cycle. So far I’ve tried putting my stuff in
// didn't expect it to work
-(id)init
// didn't expect it to work
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
// had hopes for this one, but no such luck
-(id)initWithCoder:(NSCoder *)aDecoder {
// this one looked promising...
-(id)awakeAfterUsingCoder:(NSCoder *)aDecoder {
// not much hope
-(void)awakeFromNib {
// my main candidate for a long while...
-(void)viewDidLoad {
When I run the interface loads perfectly, I get my tabs, my navigation bar, my view. But no matter how much NSLog() I do in HomeViewController there’s never any output in the console.
Am I missing something about the lifecycle of the storyboard? Is my controller not instantiated or used?
The problem was that I recently renamed the storyboard and didn’t realise Xcode does not rename the
Main Storyboardsetting. I’ve cleaned the project numerous times and still it seems the old storyboard is present and loaded.