Ios weibo Construction

Source: Internet
Author: User

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] ;}}




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.