可能是重复问题:
检查 iPhone iOS 版本
iOS 5 中的一个更改是能够覆盖 drawrect
方法。这意味着我需要以不同的方式更改navigationBar和tabBar的外观。我能够使用苹果的新方法:
[[UINavigationBar appearance]setBackgroundImage:[UIImage imageNamed:@"navigationBarBackgroundRetro.png"] forBarMetrics:UIBarMetricsDefault];
//I create my TabBar controlelr
tabBarController = [[UITabBarController alloc] init];
// I create the array that will contain all the view controlers
[[UITabBar appearance] setBackgroundImage:
[UIImage imageNamed:@"navigationBarBackgroundRetroTab.png"]];
[[UITabBar appearance] setSelectionIndicatorImage:
[UIImage imageNamed:@"tab_select_indicator"]];
我正在开发一个适用于iOS 4.3和5.0的应用程序。然而,iOS 5会忽略我重写的drawrect
方法,所以应该运行上面的代码。我该如何检查iOS版本,以便在设备运行iOS 5时使用上述代码?