你如何使UINavigationBar透明?虽然我希望它的酒吧项目仍然可见.
是ios的新手,我发现这个解决方案使UINavigationBar透明化.在我的项目文件中我可以放置此代码
[self.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
Run Code Online (Sandbox Code Playgroud)
因此它应用于我正在使用导航控制器的整个项目中.
我已经尝试了很多让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]
}];
Run Code Online (Sandbox Code Playgroud)