29,030
社区成员
发帖
与我相关
我的任务
分享
//设置splashVC,显示splashVC.view。不使用其他splashVC的功能
self.splashViewController=[[UIViewController alloc]init];
NSString * splashImageName=@"splash.jpg";
if(self.window.bounds.size.height>480){
splashImageName=@"splashR4.jpg";
}
self.splashViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:splashImageName]];
//把splashVC添加进去
[self.window addSubview:self.splashViewController.view];
//⬇️ 让splashimage显示2s,让用户看一眼得了。
[self performSelector:@selector(splashAnimate:) withObject:@0.0 afterDelay:2.0];
-(void) splashAnimate:(NSNumber *)alpha{
// ⬇️ 只能用UIViewAnimationOptionCurveEaseInOut和ViewAnimationOptionTransitionNone两种效果
UIView * splashView=self.splashViewController.view;
[UIView animateWithDuration:1.0 animations:^{
splashView.transform=CGAffineTransformScale(splashView.transform, 1.5, 1.5);
splashView.alpha=alpha.floatValue;
} completion:^(BOOL finished) {
//ARC通过赋值nil释放内存,动画中不能removeFromSuperview.
[splashView removeFromSuperview];
self.splashViewController=nil;
}];
}
这个思路是否满足你的要求呢??
不过我感觉程序员如果大了起来,自然启动画面时间就长了~~~