[英]UINavigationBar needs to be transparent
I have got UINavigationBar styling set in AppDelegate but it doesn't seem to be taking effect on my app. 我在AppDelegate中设置了UINavigationBar样式,但是它似乎并未对我的应用生效。 I am using XCode 5 and my code is as follows:
我正在使用XCode 5,我的代码如下:
- (void) customizeApp
{
UIImage* menuBackground = [UIImage imageNamed:@"menu-bar.png"];
[[UINavigationBar appearance] setBackgroundImage:menuBackground forBarMetrics:UIBarMetricsDefault];
// Customize the title text for *all* UINavigationBars
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0],
UITextAttributeTextColor,
[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8],
UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)],
UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"HelveticaNeue-Light" size:0.0],
UITextAttributeFont,
nil]];
}
Im not sure what Im doing wrong and why its not working. 我不确定自己在做什么错以及为什么它不起作用。 This was working in XCode 4/iOS6
这在XCode 4 / iOS6中有效
[self.navigationController.navigationBar setBackgroundImage:menuBackground forBarMetrics:UIBarMetricsDefault];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.