Ios weibo Construction
Create a Program Load Interface
-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {// 1> Create window self. window = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen]. bounds]; // 2> set the window's root controller UITabBarController * tabBarController = [[UITabBarController alloc] init]; self. window. rootViewController = tabBarController; // 3> display window [self. window makeKeyAndVisible]; return YES ;}The Contents. json file in the LaunchImage configuration LaunchImage. launchimage file records the detailed configuration of LaunchImage:
Cancel APP icon Rendering
Hide the status bar when the program is loaded
To restore the status bar display after the program is loaded, you can call the [application setStatusBarHidden: NO] Method in the didfinishlaunchingwitexceptions method;
Rendering Image
In iOS7, The selectedImage image is rendered blue again. To display the source image, you must cancel the rendering;
Method for canceling rendering call:
selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
How to distinguish ios6 from ios7
# Define iOS7 ([[UIDevice currentDevice]. systemVersion doubleValue]> = 7.0), usually in the ItcastWeibo-Prefix.pch
How can I set different images based on ios6 and ios7? For example, the image of ios6 is convex and the image of ios7 is flat?
Write a category # 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) {// image without the _ os7 suffix = [UIImage imageNamed: name];} return image;} // non-iOS7 return [UIImage imageNamed: name];} retrieve different images by category // set the selected icon UIImage * selectedImage = [UIImage imageWithName: selectedImageName]; if (iOS7) {childVc. tabBarItem. selectedImage = [selectedImage imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];} else {childVc. tabBarItem. selectedImage = selectedImage ;}
After the controler is created, a tableItem is created. After the custom tablebar has been initialized, all the tablebars of the system need to be deleted after being loaded. After the view is loaded, it is deleted.
// 2. encapsulate a navigation controller UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController: childVc]; [self addChildViewController: nav]; // 3. add the button [self. customTabBar addTabBarButtonWithItem: childVc. tabBarItem];
-(Void) viewWillAppear :( BOOL) animated {[super viewWillAppear: animated]; // Delete the UITabBarButton (UIView * child in self. tabBar. subviews) {if ([child isKindOfClass: [UIControl class]) {[child removeFromSuperview] ;}}