简体   繁体   中英

iOS 7 Clear Navigation Bar

I am working on an App and would like to make the Navigation Bar Transparent. Is this possible or will the Navigation Bar either be visible or completely hidden? On the image below what I would like is for the NavBar to be clear but the Back Arrow to still be visible. Along the same lines, how would I change the text for the Back Button.

Thanks!

在此处输入图片说明

Following is way to set visible navigation for your app . here is complete guide : http://www.appcoda.com/customize-navigation-status-bar-ios-7/

Add below code in your -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

// iOS 7 Changes - Set the Font,Font Size and Navigation bar Background 
    [[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x0219FF)]; //324F85  color you want to set
    NSShadow *shadow = [[NSShadow alloc] init];
    shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
    shadow.shadowOffset = CGSizeMake(0, 1);
    [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                           [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,
                                                           shadow, NSShadowAttributeName,
                                                           [UIFont fontWithName:@"Helvetica Neue" size:21.0], NSFontAttributeName, nil]];
    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

Add following code in your view controller to change text color of the back button.

[navController.navigationBar setTintColor:[UIColor colorWithRed:68.0/255.0 green:91.0/255.0 blue:120.0/255.0 alpha:1.0]];

or add following code in your app delegate

[[UINavigationBar appearance] setTintColor:[UIColor yellowColor]];

About your second answer, It's a bit weird, but the back button actually belongs to the view controller that it backs too. so in that view controller, you should put

self.navigationItem.backBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];

change to the title of your'e choice

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM