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. Elasticsearch教程(六) elasticsearch Client创建

    Elasticsearch  创建Client有几种方式. 首先在 Elasticsearch  的配置文件 elasticsearch.yml中.定义cluster.name.如下: cluster ...

  2. oracle 12C SYS,SYSTEM用户的密码都忘记或是丢失

    密码 conn / as sysdba alter user system identified by Abcd1234; manual script first -->manual_scrip ...

  3. 【Android工具类】怎样保证Android与server的DES加密保持一致

    转载请注明出处:http://blog.csdn.net/zhaokaiqiang1992 在我们的应用程序涉及到比較敏感的数据的时候,我们一般会对数据进行简单的加密.在与server之间的数据交互中 ...

  4. bc的用法

    bc是An arbitrary precision calculator language,即一个任意精度的计算语言,注意是一种语言,它提供了一些语法结构,比如条件判断.循环等,可以说是很强大的,但是 ...

  5. PowerShell-将CSV导入SQL Server

    $database = 'foxdeploy' $server = '.' $table = 'dbo.powershell_test' Import-CSV .\yourcsv.csv | ForE ...

  6. 通过特定获取获取电脑外网IP地址

    void get_WanIp() { }; ]; ]; ; }; GetTempPathA(MAX_PATH,szFilePath); strcat(szFilePath,"IPinTheW ...

  7. Ffmpeg音频转码 卡顿(MP2转AAC)

    最好经手一个小的功能将mp2实时流转成AAC并发布成rtmp音频流,本身不是很难的一个需求, 一个晚上就能将功能开发好.功能开发完毕后,找来一音频文件利用Ffmpeg命令将音视频文件推成 实时udp格 ...

  8. 转 拉姆达表达式,委托、匿名方法、Lambda表达式的演进

    总结:Lambda表达式的语法:(参数列表=>执行语句) 无参数格式 :()=>{执行语句} 有参数格式:x=> x % 2 == 0 1.假设给我们一个泛型对象List<T& ...

  9. nginx日志统计流量

    cat access.log |awk '{sum+=$10} END {print sum/1024/1024/1024}' $10是nginx字段bytes_sent 字段,根据自己的日志格式修改 ...

  10. Proftp设置虚拟用户(转)

    首先在proftpd.conf中添加:        AuthOrder mod_auth_file.c mod_auth_unix.c AuthUserFile /usr/local/etc/ftp ...