如何从启动画面中删除导航栏?

时间:2011-07-21 08:53:58

标签: iphone xcode uiview uiviewcontroller uiwindow

我有问题,在我的代码中我创建一个时间间隔的启动画面。当它执行时,然后在视图的顶部出现导航栏。现在我想隐藏那个导航栏。我如何删除该启动画面?

- (void)loadView {
// Init the view
//CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
CGRect appFrame = CGRectMake(0, 0, 320, 480);
UIView *view = [[UIView alloc] initWithFrame:appFrame];
view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
self.view = view;
[view release];

splashImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"LS.jpg"]];
splashImageView.frame = CGRectMake(0, 44, 320, 460);
[self.view addSubview:splashImageView];

viewController = [[Menu alloc] init];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:viewController];
viewController.view.alpha = 0.0;
[self.view addSubview:nc.view];

timer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(fadeScreen) userInfo:nil repeats:NO];}
-(void) onTimer{
NSLog(@"LOAD");

}

- (void)fadeScreen{
[UIView beginAnimations:nil context:nil]; // begins animation block
[UIView setAnimationDuration:0.75];        // sets animation duration
[UIView setAnimationDelegate:self];        // sets delegate for this block
[UIView setAnimationDidStopSelector:@selector(finishedFading)];   // calls the finishedFading method when the animation is done (or done fading out)    
self.view.alpha = 0.0;       // Fades the alpha channel of this view to "0.0" over the animationDuration of "0.75" seconds
[UIView commitAnimations];   // commits the animation block.  This Block is done.

}

- (void) finishedFading{

[UIView beginAnimations:nil context:nil]; // begins animation block
[UIView setAnimationDuration:0.75];        // sets animation duration
self.view.alpha = 1.0;   // fades the view to 1.0 alpha over 0.75 seconds
viewController.view.alpha = 1.0;
[UIView commitAnimations];   // commits the animation block.  This Block is done.
[splashImageView removeFromSuperview];

}

4 个答案:

答案 0 :(得分:0)

在启动视图控制器中,将其添加到viewDidLoad。

self.navigationController.navigationBar.hidden = YES;

答案 1 :(得分:0)

您可以按self.navigationController.navigationBar.hidden = YES;

隐藏导航栏

“默认”启动画面:
使用iOS的 Default.png 图像功能是Splash Screens的绝佳选择。只需将一个名为“Default.png”的图像('D'应为大写)添加到您的项目中,操作系统将负责其余的工作。

答案 2 :(得分:0)

我宁愿将navigationcontroller的视图添加到窗口而不是splash视图控制器视图。同时更改启动图像的帧以使其高度为480.您也可以将Default.png改为@EmptyStack建议

答案 3 :(得分:0)

在Info.plist中,您可以将属性“状态栏最初隐藏”添加到YES,状态栏将永远消失!

相关问题