我已经尝试了很多让UINavigationBar透明的东西.但我没有成功.我设置的图像是透明的.这是我的代码.
有帮助吗?
提前致谢.
有帮助吗?
提前致谢.
[rootNavC.navigationBar setBackgroundImage:[UIImage imageNamed:@"NAV_BG_iphone.png"] forBarMetrics:UIBarMetricsDefault];
rootNavC.navigationBar.translucent = YES;
rootNavC.navigationBar.backgroundColor = [UIColor clearColor];
[[UINavigationBar appearance] setTitleTextAttributes:@{
UITextAttributeTextColor : [UIColor whiteColor],UITextAttributeTextShadowColor : [UIColor clearColor],UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake(0,0)],UITextAttributeFont : [UIFont fontWithName:@"pastel" size:20]
}];
解决方法
试试这个
[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];
我希望上面的代码有所帮助.