Summarize some of the common small methods in iOS

Source: Internet
Author: User

First, change the color of the status bar:

(1), add in Project Info plist: View controller-based status bar appearance set to NO

(2), in the project Baseviewcontroller inside Add Method:

Set the status bar color to White

if (ios7later) {//Determine if it is IOS7

[[UIApplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent Animated:NO];

}

Second, set the project Launchscreen display time:

How to delegate in app:

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions Add a method to the:

[Nsthread sleepfortimeinterval:3.0];//set Start Page time

Third, the system version judgment method:

The version of the system is judged

#define KSYSVERSION ([[[Uidevice Currentdevice] systemversion] floatvalue])

#define Ios8later (ksysversion >= 8.0f)

#define Ios7later (ksysversion >= 7.0f)

#define Ios6later (ksysversion >= 6.0f)

#define IOS7 (ksysversion >= 7.0f && ksysversion < 8.0f)

Four, obtain the system Appdelegate realizes the Jump method:

Appdelegate * Appdele = (appdelegate *) [uiapplication sharedapplication].delegate;

Tabbarviewcontroller *ghtabbar = [[Tabbarviewcontroller alloc] init];

Homeviewcontroller * HOMEVC = [[Homeviewcontroller alloc] init];

AppDele.window.rootViewController = Homevc/ghtabbar;

Five, the parameter of the macro definition method:

#define COLOR (a,b,c,d) [Uicolor colorwithred:a/255.0 green:b/255.0 blue:c/255.0 alpha:d]

#define SYSTEMFONT (size) [Uifont systemfontofsize:size]

#define Appdelegateinstance ((appdelegate*) ([UIApplication sharedapplication].delegate)

Vi. How to create a PCH file:

(1), create a PCH file first

(2), found in BUiD settings: Apple llvm-language: precompile Prefix Header set it to YES

In the prefix Header, write his absolute path (the absolute path method: Open the terminal. Drag the. pch file from your project into the terminal. And then copy the path).

Write so much first. July 9, 2016 21:53 by Jiang Ailu.

Summarize some of the common small methods in iOS

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.