http://ww1.sinaimg.cn/large/721c0e13jw1ewvrk8qpnyj20ko062q37.jpg
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg"] forBarMetrics:UIBarMetricsCompact];
// 去除 navigationBar 下面的线
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
}
按网上写的 setShadowImage 根本没用啊,请问到底应该如何设置?
1
LSBs 2015-10-10 09:21:05 +08:00 2
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigation_bar_background.png"] forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:[UIImage imageNamed:@"navigation_bar_background.png"] ]; self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; 图片是 1*1 像素 全通道全透明的图片 |
2
akring 2015-10-10 09:34:23 +08:00 1
[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]]; 和楼上差不多,不过不用专门设置图片,亲测有效 |
6
loveuqian 2015-10-10 16:07:10 +08:00
|