【问题标题】:UINavigationBar Appears Under UIStatusBarUINavigationBar 出现在 UIStatusBar 下
【发布时间】:2013-10-11 07:44:17
【问题描述】:

UINavigationBar 在 iOS 6 中出现在 UIStatusBar 下(它在 iOS 7 中正常运行),我正在使用带有 Xocde 5 的情节提要,

: 这是我的代码sn-p,

- (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;
}

主页上的代码,

- (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;
}

我在哪里做错了??

提前致谢。

【问题讨论】:

  • 嗨,我在我的应用程序中遇到了同样的问题,请在展示您的视图控制器后设置时间延迟
  • 试试这个 - (void)viewDidLoad { [super viewDidLoad]; [self performSelector:@selector(presentListView) withObject:self afterDelay:0.5]; } -(void)presentListView { CRViewController *Obj=[[CRViewController alloc] init]; [self.tabBarController presentViewController:Obj 动画:YES 完成:nil]; }

标签: iphone ios ios6 uinavigationbar uistatusbar


【解决方案1】:
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 animateWithDuration:0.5

动画:^ {

CGRect tabFrame = tabBar.frame;

tabFrame.origin.y = CGRectGetMaxY(window.bounds);

tabBar.frame = tabFrame; content.frame = window.bounds;

}];

}

【讨论】:

    猜你喜欢
    • 2013-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多