我在iOS6中製作了應用程序。正如我在iOS7運行,這表明是如何在iOS7中設置UINavigationBar?
我試過這個代碼,但沒有用。
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
nav.navigationBar.translucent = NO;
我該怎麼做。我廈門國際銀行是這樣
我在iOS6中製作了應用程序。正如我在iOS7運行,這表明是如何在iOS7中設置UINavigationBar?
我試過這個代碼,但沒有用。
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
nav.navigationBar.translucent = NO;
我該怎麼做。我廈門國際銀行是這樣
在您的viewDidLoad
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
{
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}
else
{
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
添加幾行代碼,並將其定義方法
- (BOOL)prefersStatusBarHidden
{
return YES;
}
這個工作對我來說..祝您好運。 。:-)
將這兩行加入您的viewDidLoad
方法
if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout=UIRectEdgeNone;
if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)])
self.automaticallyAdjustsScrollViewInsets=NO;
希望這會對你有幫助。
凡下來投票,必須告知理由。 – Duaan
看到我這麼回答http://stackoverflow.com/questions/18953509/how-to-prevent-navigation-bar-from-covering-top-of-view-in-ios-7/18953585#18953585 – Deepesh