UINavigationBar set tintcolor tested in iOS7 not working?

后端 未结 6 1281
攒了一身酷
攒了一身酷 2021-02-07 01:26

I have an app which have a UINavigationBar and I have set the tint color to black like this:

self.navigationController.navigationBar.tintColor = [UI         


        
6条回答
  •  佛祖请我去吃肉
    2021-02-07 01:53

    I used following code to change tint color of navigation bar in iOS7,I added this in app delegate "applicationDidFinishLaunch" method and its work fine for me :

    /* ios 7 Change */
        if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
        {
            [[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x4B678B)];
            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]];
            // self.navigationController.navigationBar.barTintColor = [UIColor blueColor];
            //[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
            [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    
        }
    

提交回复
热议问题