简体   繁体   中英

Can I set a navigationBar transparent in Storyboard?

I have several UIViewControllers in a UITabBarController.

In each UIViewController's viewDidLoad method I include this line:

self.navigationController.navigationBar.translucent = NO;

Is there a setting in Storyboard that can do the same?

是的,您可以更改导航控制器的导航栏,只需在文档大纲中将其选中即可 ,检查此iOS7导航栏是否为半透明=否

I couldn't do this on storyboard (Xcode 8, iOS 10), instead I used a custom navigationBar and overriding the awakeFromNib:

-(void)awakeFromNib
{
    [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    self.shadowImage = [UIImage new];
    self.translucent = YES;
}

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