Here is my question :
I have an app running smoothly on iOS 3.0
I’ve been working a long time to port it to 4.0 and to include the new features.
I added iAds using Interface Builder.
I know that I have to define it programmatically to still support 3.0 devices.
I weak linked the framework. But the app crashes when loading the NIB.
Is there a way to load NIB’s depending on the firmware version ?
Let’s say I have FirstView.xib and FirstView3X.xib
How can I choose which one will be loaded depending on the firmware ?
Thanks
PS: It’s my first question on StackOverflow !
Congratulations to your first question 🙂 How do you load the nibs? It’s a good idea to split the interface into several files. I usually use a separate nib per every controller and load them using the
initWithNibName:bundle:initializer. Since you supply the nib name here, you could easily customize the loading behaviour.If you load the nibs using the tab bar controller, you probably have all the tabs in one nib. I think I would break the tabs into separate nibs and load them programmatically:
And since you would now have the control over the nib names, you could easily detect the firmware version and load the correct nib:
As for the firmware version detection itself, I think you could use [UIDevice systemVersion].