AdvertisementViewController
里实现自己想要效果,例如添加背景图片 && logo && 展示文字的Label等,viewdidload中调用adStart代码如下:- (void)adStart {
// 背景图片
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
imageView.image = [UIImage imageNamed:@"launchpage_BackgroundImage"];
[self.view addSubview:imageView];
// 添加Logo
UIImage *logoIm = [UIImage imageNamed:@"launchpage_logo"];
CGFloat logoImWidth = logoIm.size.width;
CGFloat logImHeight = logoIm.size.height;
UIImageView *logoIV = [[UIImageView alloc] initWithFrame:CGRectMake((FrameW - logoImWidth)/2, FrameH - 84/2*WidthScale375 - logImHeight, logoImWidth, logImHeight)];
logoIV.image = logoIm;
[self.view addSubview:logoIV];
// 添加label
UILabel *lab = [[UILabel alloc] initWithFrame:CGRectMake(5, FrameH - 15 - 40/2*WidthScale375, FrameW - 10, 15)];
lab.text = @"要展示的文字";
lab.textAlignment = NSTextAlignmentCenter;
[self.view addSubview:lab];
// 初始化定时器
_timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(adChangeNextViewController) userInfo:nil repeats:NO];
}
/** 定时展示完页面后触发方法 */
- (void)adChangeNextViewController {
[((AppDelegate *)([UIApplication sharedApplication].delegate)) showNextViewController];
}
(1) appDelegate.h中暴露方法
/** 模拟启动页回来调用的方法 */
- (void)showNextViewController;
(2)appDelegate.m 在didFinishLaunchingWithOptions
方法中进行相关更改
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// 模拟启动页
AdvertisementViewController *StartFigure = [[AdvertisementViewController alloc] init];
self.window.rootViewController = StartFigure;
[self.window makeKeyAndVisible];
return YES;
}
/** 模拟启动页回来调用的方法 */
- (void)showNextViewController {
// 模拟启动图结束了,跳这里,这里面正常处理,例如:改走引导页,或者TabBarController或者登录页面等等,自己决定啦。。。
self.window.rootViewController= 引导页/TabBarController/登录页面;
}
AdvertisementViewController
的背景图片设为和启动图一样的图片,前提是启动图较为干净,这样就能很好的实现启动图和自己写AdvertisementViewController
之间界面切换的无痕性。AdvertisementViewController
进行相应的实现即可啦!