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

ナビゲーションバーを非表示にするにはself.navigationController.navigationBar.hidden = YES;

「デフォルト」のスプラッシュ スクリーン: iOSのDefault.png
画像機能を 使用することは、スプラッシュ スクリーンの優れた代替手段です。「Default.png」 (「D」は大文字)という名前の画像をプロジェクトに追加するだけで、あとは OS が処理します。

于 2011-07-21T09:02:53.350 に答える
0

スプラッシュ ビュー コントローラー ビューの代わりに、ナビゲーション コントローラーのビューをウィンドウに追加したいと思います。また、スプラッシュ画像のフレームを高さ 480 に変更します。@EmptyStack が提案したように、Default.png を使用することもできます。

于 2011-07-21T09:03:28.017 に答える
0

スプラッシュ ビュー コントローラーで、これを viewDidLoad に追加します。

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

Info.plist で、「ステータス バーは最初は非表示です」というプロパティを YES に追加すると、ステータス バーが完全に消えます。

于 2012-04-06T11:22:12.607 に答える