现在很多App都有开机之后加载有广告的页面 这个页面其实是一个连接 可以随时改变加载的广告 实现如下:
首先要在项目中加入一个加载图片的框架 SDWebImage 这个大家应该都熟悉 然后在
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { }方法中 实现
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
[self.window makeKeyAndVisible];
self.window.rootViewController = [[CustomViewController alloc]init];
self.imageV = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
[self.imageV sd_setImageWithURL:[NSURL URLWithString:@"加入你的图片连接"] placeholderImage:nil];
[self.window addSubview:self.imageV];
设置图片的显示时间 之后移除
[self performSelector:@selector(deleteImageView) withObject:nil afterDelay:6];
}
// 移除图片
-(void)deleteImageView{
[self.imageV removeFromSuperview];
}