首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UINavigationBar出现在UIStatusBar下面

UINavigationBar出现在UIStatusBar下面
EN

Stack Overflow用户
提问于 2013-10-11 07:44:17
回答 1查看 221关注 0票数 0

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

这是我的代码片段

代码语言:javascript
复制
- (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上的代码,

代码语言:javascript
复制
- (void)viewDidLoad
{
    [super viewDidLoad];

        CRViewController *Obj=[[CRViewController alloc] init];
        [self.tabBarController presentViewController:Obj animated:YES completion:nil];

}

当我在didFinishLaunchingWithOptions方法之后运行我的应用程序时,viewDidLoad被解雇了,这就调用了CRViewController类。

CRViewController上的代码,

代码语言:javascript
复制
- (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;
}

,我在哪里做错了??

预先谢谢.

EN

回答 1

Stack Overflow用户

发布于 2013-10-24 10:56:32

代码语言:javascript
复制
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;

}];

}

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19312867

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档