I started iphone development with 4.0 sdk. I am trying to make my app compatible with 3.2. I realized that -[UIWindow setRootViewController:] is added to the sdk in version 4.0. So instead of it, what should I use in pre 4.0 releases? In other words, what does rootViewController property do in essence except assigning window's primary subview? If I extend UIWindow and redefine the method as below, would it be a problem in future?
- (void) setRootViewController:(UIViewController *)controller
{
if (systemVersion < 4.0)
{
while(self.subviews.count > 0)
[[self.subviews objectAtIndex:0] removeFromSuperview];
[self addSubview:controller.view];
}
else [super setRootViewController:controller];
}
We used to do this:
[window addSubview:[navigationController view]];
That is what it used to be in Apple's samples and still works ok.
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