Hi all,
I've a UITabBarController with for UIViewController (each of one with its xib) built with Interface Builder.
I'm trying to do something inside the initWithNibName of the first ViewController, but its initWithNibName methode is not firing at all... so I put the code inside the viewDidLoad method.
How to fire the initWithNibName method without directly calling it??
In IB, in the main XIB all the UIViewController have their name set to the class name and the separate nib name set. In the separate nib, all the File's owner are set to the class type of theri respective UIViewController and all the outlets are bound cause the application is running ok...
Hi all,
I've a UITabBarController with for UIViewController (each of one with its xib) built with Interface Builder.
I'm trying to do something inside the initWithNibName of the first ViewController, but its initWithNibName methode is not firing at all... so I put the code inside the viewDidLoad method.
How to fire the initWithNibName method without directly calling it??
In IB, in the main XIB all the UIViewController have their name set to the class name and the separate nib name set. In the separate nib, all the File's owner are set to the class type of theri respective UIViewController and all the outlets are bound cause the application is running ok...
Any help?
What's the problem....just use viewDidLoad as you are doing.
initWithNibName gets calls when you init/alloc the object yourself. Because you've used IB and are probably just pushing the view using the ViewController, viewDidLoad is called instead.
What's the problem....just use viewDidLoad as you are doing.
initWithNibName gets calls when you init/alloc the object yourself. Because you've used IB and are probably just pushing the view using the ViewController, viewDidLoad is called instead.
Well, I read (in the sample code comments...) that viewDidLoad is called after the view loaded and initWithNibName before the view loads...
Moreover, maybe I'm wrong cause I'm a very newbie, viewDidLoad can be called more than one time if the system dealloc my view while it's not in use and then reinit it... isn't it??
In other words... Where do I have to put my "initialize" code that must be run only once?? (Using a xib file)
Well, I read (in the sample code comments...) that viewDidLoad is called after the view loaded and initWithNibName before the view loads...
Moreover, maybe I'm wrong cause I'm a very newbie, viewDidLoad can be called more than one time if the system dealloc my view while it's not in use and then reinit it... isn't it??
In other words... Where do I have to put my "initialize" code that must be run only once?? (Using a xib file)
Thanks
Once per View or once per app launch? If you are initialising view variables, then viewDidLoad gets called once and you setup here for each time your load a view (basically each time you create an Instance of your view). If you mean for your application, then you initialise just once in your AppDelegate method.
Once per View or once per app launch? If you are initialising view variables, then viewDidLoad gets called once and you setup here for each time your load a view (basically each time you create an Instance of your view). If you mean for your application, then you initialise just once in your AppDelegate method.
You are confusing something. It's not initWithNibName that is called when a XIB file is loaded, but awakeFromNib.
I'm having a similiar problem, all I want to do is set self.title for it to appear in my navigation controller but my initWithNibName isn't being called, can I just set the title somewhere else, because it's not working if I do it in the viewDidLoad?
You are going to have to post some code, or at least tell us what you are doing so we can figure out if you are making a mistake. Because both methods work just fine normally.
I've checked with NSLogs and my initWithNibName definitely isn't firing and viewDidLoad definitely is. All I should need in my viewDidLoad is still "self.title=@"Something";" isn't it?
My view is loading fine inside the navView, which is connected correctly the controller, yet doesn't seem to be accessing the navigationView.
Any ideas? Or is there anything else I can tell you about it?