UINavigationBar出现在UIStatusBar in iOS 6下(它在iOS 7中运行正常),我使用的是Xocde 5的故事板。

这是我的代码片段
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[UIApplication sharedApplication].statusBarHidden = NO;
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7) //iOS 6
{
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"TabImg.png"]];
[[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:.7 green:.2 blue:.1 alpha:1.0]];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
}
return YES;
}HomePage上的代码,
- (void)viewDidLoad
{
[super viewDidLoad];
CRViewController *Obj=[[CRViewController alloc] init];
[self.tabBarController presentViewController:Obj animated:YES completion:nil];
}当我在didFinishLaunchingWithOptions方法之后运行我的应用程序时,viewDidLoad被解雇了,这就调用了CRViewController类。
CRViewController上的代码,
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES];
self.tabBarController.tabBar.hidden = YES;
[UIApplication sharedApplication].statusBarHidden = YES;
...
...
...
}
- (IBAction)SkipClick:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
-(void)viewDidDisappear:(BOOL)animated{
[self.navigationController setNavigationBarHidden:NO];
self.tabBarController.tabBar.hidden = NO;
[UIApplication sharedApplication].statusBarHidden = NO;
},我在哪里做错了??
预先谢谢.
发布于 2013-10-24 10:56:32
Navigation is showing in ios 7 than you have check this it will work
NSString *version = [[UIDevice currentDevice] systemVersion];
int ver = [version intValue];
if (ver > 7)
{
}
else
{
self.edgesForExtendedLayout = UIRectEdgeNone;}
self.tabBarController.tabBar.hidden = YES;在ios 7中不工作,它显示的是黑色屏幕。比你能隐藏的还要多
-(void)hideTabBar
{
UITabBar *tabBar = self.tabBarController.tabBar;
UIView *parent = tabBar.superview;// UILayoutContainerView
UIView *content = parent.subviews objectAtIndex:0;// UITransitionView
UIView *window = parent.superview;
[UIView动画:0.5
动画:^{
CGRect tabFrame = tabBar.frame;
TabFrame.原.y= CGRectGetMaxY(window.bounds);
tabBar.frame = tabFrame;content.frame = window.bounds;
}];
}
https://stackoverflow.com/questions/19312867
复制相似问题