-
根据window的切换达到启动页面的设计
1. 在appDelegate新增一个UIWindow *delayLaunchWindow;对象@interface AppDelegate () { UIWindow *delayLaunchWindow; }
2. 在不修改之前框架的情况下,新增window控制器
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [self setupRootCtl]; [self delayLaunchImage]; return YES; } - (void)setupRootCtl { self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.window.backgroundColor = [UIColor whiteColor]; MainMenuTabBarVC *mainMenuVC = [[MainMenuTabBarVC alloc] init]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:mainMenuVC]; self.window.rootViewController = nav; [self.window makeKeyAndVisible]; } - (void)delayLaunchImage { delayLaunchWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.window.backgroundColor = [UIColor whiteColor]; delayLaunchWindow.rootViewController = [UIViewController new]; delayLaunchWindow.backgroundColor = [UIColor redColor]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds]; [imageView setImage:[UIImage imageNamed:@"11.PNG"]]; [delayLaunchWindow addSubview:imageView]; [delayLaunchWindow makeKeyAndVisible]; self.window.backgroundColor = [UIColor whiteColor]; [self performSelector:@selector(cancelLaunImage) withObject:nil afterDelay:5]; }
3. 启动动画完成,移除window控制器
- (void)cancelLaunImage { [delayLaunchWindow resignKeyWindow]; delayLaunchWindow = nil; }
完成收工!~~~
启动页动画设计原理
猜你喜欢
转载自blog.csdn.net/qiutiange1205/article/details/81240521
今日推荐
周排行