Remove the navigation bar split line and set the background color of the navigation bar

Source: Internet
Author: User

1  //Remove the split line below the navigation bar2     if([Self.navigationController.navigationBar respondstoselector: @selector (setbackgroundimage:forbarmetrics:)]) {3Nsarray *list=self.navigationController.navigationBar.subviews;4          for(IDObjinchlist) {5             if([obj Iskindofclass:[uiimageviewclass]]) {6Uiimageview *imageview= (Uiimageview *) obj;7Nsarray *list2=imageview.subviews;8                  for(IDObj2inchList2) {9                     if([Obj2 Iskindofclass:[uiimageviewclass]]) {TenUiimageview *imageview2= (Uiimageview *) Obj2; Oneimageview2.hidden=YES; A                     } -                 } -             } the         } -     } -  -  +  -Self.automaticallyadjustsscrollviewinsets =NO; +Self.edgesforextendedlayout = Uirectedgetop;//Top Start ASelf.navigationController.navigationBar.translucent = YES;//Navigation bar Transparency at[Self.navigationController.navigationBar setbackgroundimage:[uiimage imagenamed:@"Barpic1"] Forbarmetrics:uibarmetricsdefault];//Add background color (picture) (main if you want to set the navigation bar to transparent) • Just use a transparent picture.) -     //set the navigation bar text to white -self.navigationcontroller.navigationbar.titletextattributes=[nsdictionary Dictionarywithobjectsandkeys:[uicolor whitecolor],uitextattributetextcolor, nil]; -     //set back button to white - [Self.navigationController.navigationBar settintcolor:[uicolor whitecolor]; -     //Set Back button unity to return inUibarbuttonitem *item = [[Uibarbuttonitem alloc] Initwithtitle:@"return"style:uibarbuttonitemstyleplain Target:nil Action:nil]; -Self.navigationItem.backBarButtonItem = Item;

Remove the navigation bar split line and set the background color of the navigation bar

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.