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;
}
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;
}
我在哪里做错了?
提前致谢。
答案 0 :(得分: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 = 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;
}];
}