如何设置启动页面的动画?
/启动页只能有assets的图片或者storyboard图片的形式,所以无法直接做动画效果,但是可以通过获取storyboard的Vc.view 实现动画,如下
1.在LaunchStoryboard中添加启动页图片并设置约束
2.在控制器中的加载view时进行如下操作:
2.1获取到LaunchstoryBoard中view
UIStoryboard*styB = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil];
UIViewController*VC = [styB instantiateInitialViewController];//找到登陆界面初始化的控制器
UIView*Boardview = VC.view;
2.2 将获取到的view和控制器的view建立联系
[self.view addSubview:Boardview];
2.3 给view设置动画效果
[UIView animateWithDuration:1.0 animations:^{
Boardview.transform = CGAffineTransformMakeScale(1.5, 1.5);
Boardview.alpha=0;
2.4 移除view
}completion:^(BOOLfinished){
[BoardviewremoveFromSuperview];
}];
}