Appdelegate裏面右個這個函數,只要它沒結束,你的等待界面就不會消失。
以在啓動的時候作些動畫app
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ide
// Override point for customization after application launch.函數
[window addSubview:viewController.view];動畫
[self.window makeKeyAndVisible];spa
//裝載啓動頁的視圖
imgview=[[UIImageView alloc]initWithFrame:self.window.frame];
imgview.image=[UIImage imageNamed:@"Default"];
imgview.alpha = 0.0;
[bgView addSubview:imgview];
//動畫--淡入
[UIView beginAnimations:nil context:nil];//標記動畫塊開始
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];//定義動畫加速和減速方式
[UIView setAnimationDuration:0.5];//動畫時長
[UIView setAnimationDelegate:self];
imgview.alpha = 1.0;
//動畫結束後回調方法
[UIView setAnimationDidStopSelector:@selector(showArrowDidStop:finished:context:)];
[UIView commitAnimations];//標誌動滑塊結束rem
return YES;get
}animation
//動畫--淡出
-(void)hiddenAnimation
{
[UIView animateWithDuration:0.5 animations:^{
imgview.alpha=0.0;
} completion:^(BOOL finished) {
[imgview removeFromSuperview];
[bgView removeFromSuperview];
}];
// [UIView beginAnimations:@"HideArrow" context:nil];
// [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
// [UIView setAnimationDuration:0.5];
// [UIView setAnimationDelay:1.0];
// imgview.alpha = 0.0;
// [UIView commitAnimations];
}
- (void)showArrowDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(hiddenAnimation) userInfo:Nil repeats:NO];
}it