【发布时间】:2015-05-11 03:17:03
【问题描述】:
我的个人资料视图控制器嵌入在导航控制器中,并以彩色导航栏显示。但我想避免这种情况或如何使导航栏背景颜色为 clearColor。这样它就可以显示它下面的图像,例如。推特应用
【问题讨论】:
标签: ios objective-c uinavigationcontroller uinavigationbar uinavigationitem
我的个人资料视图控制器嵌入在导航控制器中,并以彩色导航栏显示。但我想避免这种情况或如何使导航栏背景颜色为 clearColor。这样它就可以显示它下面的图像,例如。推特应用
【问题讨论】:
标签: ios objective-c uinavigationcontroller uinavigationbar uinavigationitem
试试这个代码:
[self.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
self.navigationController.navigationBar.tintColor = [UIColor clearColor];
self.navigationController.navigationBar.backgroundColor = [UIColor clearColor];
【讨论】:
试试这个
[self.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
迅速
self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationBar.shadowImage = UIImage()
self.navigationBar.translucent = true
【讨论】:
非常有范儿, 你可以试试:
YourNavigation.navigationBar.barTintColor = [UIColor clearColor];
YourNavigation:输入您的 NavigationController。
如果这有帮助,你可以帮我标记一下!
谢谢
【讨论】:
将此行放入AppDelegate的didFinsihLaunchingWithOptions:
[[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; // This is for clear navigation bar
[[UINavigationBar appearance] setShadowImage:[UIImage new]]; // this for remvove line under the navigationbar
【讨论】:
[self.navigationController.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [UIImage new];
self.navigationController.navigationBar.translucent = YES;
self.navigationController.view.backgroundColor = [UIColor clearColor];
self.navigationController.navigationBar.backgroundColor = [UIColor clearColor];
【讨论】:
你不能让导航栏清晰。只需添加您的自定义视图,然后使其清晰。
【讨论】: