1

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

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

4 回答 4

0

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

self.navigationController.navigationBar.hidden = YES;
于 2011-07-21T09:00:04.880 回答
0

您可以通过隐藏导航栏self.navigationController.navigationBar.hidden = YES;

“默认”启动画面:
使用 iOS 的Default.png图像功能是启动画面的绝佳替代品。只需在您的项目中添加一个名为“Default.png”(“D”应为大写)的图像,操作系统将处理其余的工作。

于 2011-07-21T09:02:53.350 回答
0

我宁愿将导航控制器的视图添加到窗口而不是启动视图控制器视图。还将启动图像的框架更改为 480 的高度。您也可以按照@EmptyStack 的建议选择 Default.png

于 2011-07-21T09:03:28.017 回答
0

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

于 2012-04-06T11:22:12.607 回答