Why tintColor doesn't work on navigation bar or toolbar on iOS7

旧街凉风 提交于 2019-12-02 07:35:49

This happens because Apple assumes that we won't present more than 1 view controller and dims the background and ALL bar button items (not sure why) as default behavior to put focus on the frontmost view.

To fix this, you just need to force the tintAdjustmentMode to Normal on the app's window in DidFinishLaunchingWithOptions.

self.window.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;

Try setting

 [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"NavBarBGTile.png"] forBarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsDefault];

Where NavBarBGTile.png is a 1X1px tile image that in the color you want as navigation bar color

Also

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

Replace white with whatever you want

These lines should place at the begining of application launch

Try This Code:

UIView *masterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 260)];
UIToolbar *pickerToolbar = [self createPickerToolbarWithTitle:@"Surgeons"];
pickerToolbar.barTintColor= [UIColor blueColor];
pickerToolbar.translucent=YES;
[masterView addSubview:pickerToolbar];
[masterView addSubview:pickerViewObj];
UIViewController *viewController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
viewController.view = masterView;
viewController.contentSizeForViewInPopover = viewController.view.frame.size;
self.popoverController =[[UIPopoverController alloc] initWithContentViewController:viewController];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!