The answer to your first question: you must use iOS5 (or the latest version of the iOS SDK) as the base SDK, but you will install the minimum version of iOS running Deployment Target. There you can install iOS4.0 (or whatever).
The correct way to solve the second question is to test the capabilities, not the version. So something like this will work, say, in your method application:didFinishLaunchingWithOptions::
if ([[UINavigationBar class] respondsToSelector:@selector(appearance)]) {
UIImage *img = [UIImage imageNamed: @"NavBarBackground.png"];
[[UINavigationBar appearance] setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
}
You will then compile this against the iOS5 SDK, so using it appearancein general will be great. But when this compiled code runs on iOS version 5, it will be fine.
As already mentioned, you can save the code drawRect:as is.
source
share