Forgotten knowledge of iOS

Source: Internet
Author: User


IOS Arc Project uses non-arc files 1. No arc was used for his old project, but the third-party library was introduced using arc. for the first case, the source file with the arc is given, and the-FOBJC-ARC option is added
2. The new project uses arc, but the introduction of the third-party library or the code that was written did not use arc.


For another case, join-FNO-OBJC-ARC


Change Navigationcontroller's Back button title

A push to B. Change the return title of B

Just add the following code to a

<span style= "FONT-SIZE:18PX;" >uibarbuttonitem *backitem = [[Uibarbuttonitem alloc] Init];backitem.title = @ "Back"; Self.navigationItem.backBarButtonItem = backitem;</span>


-(instancetype) Initwithnavigationbarclass: (Class) Navigationbarclass Toolbarclass: (Class) Toolbarclass Ns_available_ios (5_0);

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions{        Self.window = [[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];        [[UIApplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent]; Uinavigationcontroller *navigationcontroller = [[Uinavigationcontroller alloc] initwithnavigationbarclass:[        Crgradientnavigationbar class] Toolbarclass:nil];    Uicolor *firstcolor = [Uicolor colorwithred:255.0f/255.0f green:42.0f/255.0f blue:104.0f/255.0f alpha:1.0f];        Uicolor *secondcolor = [Uicolor colorwithred:255.0f/255.0f green:90.0f/255.0f blue:58.0f/255.0f alpha:1.0f];    Nsarray *colors = [Nsarray arraywithobjects: (ID) firstcolor.cgcolor, (ID) secondcolor.cgcolor, nil]; Nsarray *colors = [Nsarray arraywithobjects: (ID) Uicolorfromrgb (0xf16149). Cgcolor, (ID) Uicolorfromrgb (0xf14959).        Cgcolor, nil];    [[Crgradientnavigationbar appearance] setbartintgradientcolors:colors]; [[NaviGationcontroller Navigationbar] Settranslucent:no];        Remember, the default value is YES.    Demoviewcontroller *viewcontroller = [[Demoviewcontroller alloc] init];        [Navigationcontroller Setviewcontrollers:@[viewcontroller]];        [Self.window Setrootviewcontroller:navigationcontroller];    Self.window.backgroundColor = [Uicolor Whitecolor];    [Self.window makekeyandvisible]; return YES;}



Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.

Forgotten knowledge of iOS

Related Article

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.