2011-07-21 47 views
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]; 

}

回答

0

您可以隱藏self.navigationController.navigationBar.hidden = YES;

「默認」閃屏的導航欄:
使用的是iOS的爲Default.png圖像的功能是閃屏的理想替代品。只需將名爲「Default.png」('D'應爲大寫)的圖像添加到您的項目中,操作系統將負責處理其餘部分。

+0

如何在上面的代碼中使用defualt .png圖片? – ram

+0

你甚至不需要視圖控制器。看到我更新的答案。 – EmptyStack

+0

這是「默認」而不是「Defualt」 – Pripyat

0

在濺視圖控制器,這增加viewDidLoad中。

self.navigationController.navigationBar.hidden = YES; 
0

我寧願將navigationcontroller的視圖添加到窗口而不是splash view controllers視圖。同時改變飛濺圖像的框架高度爲480.您也可以使用Default.png作爲@EmptyStack建議

0

在Info.plist中,您可以將屬性「狀態欄最初隱藏」添加到YES狀態欄永遠消失了!