怎么把我的navigationbar弄成透明的而不是带模糊的效果?
[self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
|
设置导航栏透明
#pragma mark -
视图将要出现
- ( void )viewWillAppear:( BOOL )animated
{
[ super viewWillAppear :animated];
// 导航栏背景
[ self . navigationController . navigationBar setBackgroundImage :[ UIImage imageNamed : @"nav_bargound.png" ] forBarMetrics : UIBarMetricsDefault ];
// 导航栏底部线
self . navigationController . navigationBar . shadowImage =[ UIImage imageNamed : @"nav_bargound.png" ];
}
#pragma mark - 视图将要消失
- ( void )viewWillDisappear:( BOOL )animated
{
[ super viewWillDisappear :animated];
// 导航栏背景
[ self . navigationController . navigationBar setBackgroundImage : nil forBarMetrics : UIBarMetricsDefault ];
// 导航栏底部线
self . navigationController . navigationBar . shadowImage =[ UIImage imageNamed : @"" ];
- ( void )viewWillAppear:( BOOL )animated
{
[ super viewWillAppear :animated];
// 导航栏背景
[ self . navigationController . navigationBar setBackgroundImage :[ UIImage imageNamed : @"nav_bargound.png" ] forBarMetrics : UIBarMetricsDefault ];
// 导航栏底部线
self . navigationController . navigationBar . shadowImage =[ UIImage imageNamed : @"nav_bargound.png" ];
}
#pragma mark - 视图将要消失
- ( void )viewWillDisappear:( BOOL )animated
{
[ super viewWillDisappear :animated];
// 导航栏背景
[ self . navigationController . navigationBar setBackgroundImage : nil forBarMetrics : UIBarMetricsDefault ];
// 导航栏底部线
self . navigationController . navigationBar . shadowImage =[ UIImage imageNamed : @"" ];
}