标签:style blog http color os io 文件 2014
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //1>创建窗口 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; //2>设置窗口的根控制器 UITabBarController *tabBarController = [[UITabBarController alloc] init]; self.window.rootViewController = tabBarController; //3>显示窗口 [self.window makeKeyAndVisible]; return YES; }
在程序加载完成后如需恢复状态栏显示,可以在didFinishLaunchingWithOptions方法中调用[application setStatusBarHidden:NO]方法;
在iOS7中,会对selectedImage的图片再次渲染为蓝色,要想显示原图,就必须要取消渲染;
取消渲染调用的方法:
selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
#define iOS7 ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0),一般放在 ItcastWeibo-Prefix.pch 里
写一个分类 #import "UIImage+MJ.h" @implementation UIImage (MJ) + (UIImage *)imageWithName:(NSString *)name { if (iOS7) { NSString *newName = [name stringByAppendingString:@"_os7"]; UIImage *image = [UIImage imageNamed:newName]; if (image == nil) { // 没有_os7后缀的图片 image = [UIImage imageNamed:name]; } return image; } // 非iOS7 return [UIImage imageNamed:name]; } 通过分类来获取不同的图片 // 设置选中的图标 UIImage *selectedImage = [UIImage imageWithName:selectedImageName]; if (iOS7) { childVc.tabBarItem.selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; } else { childVc.tabBarItem.selectedImage = selectedImage; }
标签:style blog http color os io 文件 2014
原文地址:http://blog.csdn.net/codywangziham01/article/details/38436415