0

UINavigationBar在 iOS 6 中出现UIStatusBar(它在 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;
}

主页上的代码,

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

我在哪里做错了?

提前致谢。

4

1 回答 1

0
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 = 是;在 ios 7 中不起作用,它显示黑屏。比你可以隐藏它

-(无效)隐藏标签栏

{

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-10-24T10:56:32.637 回答