标签:
https://www.zybuluo.com/keenleung/note/339988
注意:
做法:
// 程序启动的时候调用 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // 进入广告界面 // 1.创建窗口 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; // 2.创建窗口的根控制器 => 一开始想显示什么效果 // 创建广告界面:展示启动界面 self.window.rootViewController = [[TabBarController alloc] init]; // 3.显示窗口 makeKey:UIApplication主窗口 // 窗口会把根控制器的view添加到窗口 [self.window makeKeyAndVisible]; // 模拟显示一个全局悬浮的购物车 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // UIWindowLevelNormal < UIWindowLevelStatusBar < UIWindowLevelAlert // 级别越高的window越显示在上面 // 级别相等的window,后面显示的window显示在上面 self.topWindow = [[UIWindow alloc] init]; // self.topWindow.frame = application.statusBarFrame; self.topWindow.frame = CGRectMake(280, 500, 80, 80); self.topWindow.backgroundColor = [UIColor redColor]; self.topWindow.windowLevel = UIWindowLevelAlert; self.topWindow.hidden = NO; [self.topWindow addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(click)]]; }); return YES; }
标签:
原文地址:http://www.cnblogs.com/KeenLeung/p/5373857.html