1、定义全局成员变量

@interface AppDelegate ()

@property (strong, nonatomic) UIImageView *adImageView;

@property (strong, nonatomic) UINavigationController *rootNavi;

@end

2、实现简单广告界面

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

TextViewController* mainVC = [[TextViewController alloc] init];

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:mainVC];

self.rootNavi = nav;

if ([[UIDevice currentDevice].systemVersion doubleValue] < 7.0) {

[nav.navigationBar setBarTintColor:[UIColor clearColor]];

} else {

[nav.navigationBar setTintColor:[UIColor clearColor]];

}

注意:一定要设置空的rootViewController

UIViewController *emptyView = [[ UIViewController alloc ] initWithNibName:nil bundle:nil];

self. window .rootViewController = emptyView;

self.adImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];

[self.adImageView setImage:[UIImage imageNamed:@"bg_welcome"]];

[self.window addSubview:self.adImageView];

[self performSelector:@selector(removeAdImageView) withObject:nil afterDelay:3];

self.window.backgroundColor = [UIColor whiteColor];

[self.window makeKeyAndVisible];

return YES;

}

3、移除广告页重新设置根控制器

- (void)removeAdImageView

{

[UIView animateWithDuration:0.3f animations:^{

self.adImageView.transform = CGAffineTransformMakeScale(0.5f,0.5f);

self.adImageView.alpha = 0.f;

} completion:^(BOOL finished) {

[self.adImageView removeFromSuperview];

//        self.window.rootViewController = self.rootNavi;

[self restoreRootViewController:self.rootNavi];

}];

}

- (void)restoreRootViewController:(UIViewController *)rootViewController

{

typedef void (^Animation)(void);

UIWindow* window = self.window;

rootViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

Animation animation = ^{

BOOL oldState = [UIView areAnimationsEnabled];

[UIView setAnimationsEnabled:NO];

window.rootViewController = rootViewController;

[UIView setAnimationsEnabled:oldState];

};

[UIView transitionWithView:window

duration:0.5f

options:UIViewAnimationOptionTransitionCrossDissolve

animations:animation

completion:nil];

}

@end

4、如需实现倒计时、跳过只需要自定义View去操作就ok

............

iOS启动页加载广告的更多相关文章

  1. iOS swift 启动页加载广告(图片广告+视频广告)

    一般app在启动的时候都会有广告页,广告页用来加载自己的或者第三方的广告,广告的展示形式也多种多样,最近在看swift相关的东西,这里将提供支持加载图片广告和视频广告的解决方案 思路: 我们知道在加载 ...

  2. iOS-APP启动页加载广告

    概述 加载广告页, 展现跳过按钮实现倒计时功能, 并判断广告页面是否更新. 详细 代码下载:http://www.demodashi.com/demo/10698.html 目前市场上很多APP(如淘 ...

  3. App启动加载广告页面思路

    需求 很多app(如淘宝.美团等)在启动图加载完毕后,还会显示几秒的广告,一般都有个跳过按钮可以跳过这个广告,有的app在点击广告页之后还会进入一个广告页面,点击返回进入首页.今天我们就来开发一个广告 ...

  4. App 启动加载广告页面思路

    需求 很多app(如淘宝.美团等)在启动图加载完毕后,还会显示几秒的广告,一般都有个跳过按钮可以跳过这个广告,有的app在点击广告页之后还会进入一个广告页面,点击返回进入首页.今天我们就来开发一个广告 ...

  5. 关于App启动加载广告页面思路

    需求 很多app(如淘宝.美团等)在启动图加载完毕后,还会显示几秒的广告,一般都有个跳过按钮可以跳过这个广告,有的app在点击广告页之后还会进入一个广告页面,点击返回进入首页.虽然说这个广告页面对用户 ...

  6. iOSAPP启动时实现加载广告

    现在很多APP在启动的时候都在加载广告,现在也很流行,主要是盈利啊.笔者也做了很多关于广告的事情.现在记录下自己在APP启动的时候,怎么加载广告的. 下面总结下广告加载的三种方式 1.现在很多APP的 ...

  7. iOS欢迎界面Launch Screen动态加载广告

    有许多应用程序在打开的时候,欢迎界面会加载一张连网获取的广告图片或者显示一组动画,这样的效果是如何做到的呢?下面给大家介绍一种简单的实现加载广告的方式. 程序运行起来,欢迎界面之后,会进入AppDel ...

  8. iOS 启动页后广告Demo

    重点! 对于启动页后的广告,相信大家也都看到过很多很多的,比如我自己常看到的有 QQ音乐,爱奇艺了.你点击了APP,它会启动就会随之启动..其实这些APP的启动页是没有消失的,你去认真的观察一下!所以 ...

  9. iOS启动图和开屏广告图,类似网易

    iOS启动图和开屏广告图,类似网易 启动图是在iOS开发过程中必不可少的一个部分,很多app在启动图之后会有一张自定义的开屏广告图,点击该广告图可以跳转到广告图对应的页面.今天呢,和大家分享一下如何添 ...

随机推荐

  1. redis学习笔记——入门

    基本安装和用法:http://www.tuicool.com/articles/QzMRNb Redis如何通过本机客户端访问远程服务器段:http://blog.sina.com.cn/s/blog ...

  2. Android学习(十一) File文件操作

    File类 1.获取当前应用程序的目录: this.getFilesDir();                                             //获取当前应用程序的数据目录 ...

  3. cpu、内存、硬盘

    grep -c 'model name' /proc/cpuinfo

  4. JavaScript字符编解码

    示例代码: <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF ...

  5. Mysql5.6压缩包安装到windows&& 卸载命令

    1.根目录下有一个my-default.ini,复制一下,重命名为my.ini,然后改一下my.ini为符合你情况的配置,一般只需要改basedir .datadir .port ,注意前边的井号去掉 ...

  6. PS 流格式解析(转)

    对于PS流,最近因为工作需要,所以MPEG2中的PS流格式和解包过程进行了学习. 首先我们需要知道PS包流格式是怎么样的: 针对H264 做如下PS 封装:每个IDR NALU 前一般都会包含SPS. ...

  7. fabric自动发布tomcat线上项目

    现在公司的每个tomcat项目都有测试和生产两个环境,对于经常需要上线的tomcat项目,如用手工更新就非常耗费时间和人力.现用fabric开发了一个自动发布tomcat项目的脚本,该脚本已经在公司使 ...

  8. Security Testing Basics

    Security Testing BasicsSoftware security testing is the process of assessing and testing a system to ...

  9. ios 抓包工具 ios青花瓷charles

    iOS_青花瓷Charles抓包,ios青花瓷charles 使用青花瓷Charles抓取手机端的网络请求: 第一步,下载安装并打开Charles 第二步,去掉菜单[Proxy]以下的[Mac OSX ...

  10. 利用Bootstrap简单实现一个文件上传进度条

    © 版权声明:本文为博主原创文章,转载请注明出处 说明: 1. 使用commons-fileupload.jar实现文件上传及进度监听 2. 使用bootstrap的进度条进行页面显示 3. 因为进度 ...