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. 【共享单车】—— React后台管理系统开发手记:AntD Table高级表格

    前言:以下内容基于React全家桶+AntD实战课程的学习实践过程记录.最终成果github地址:https://github.com/66Web/react-antd-manager,欢迎star. ...

  2. .net平台 基于 XMPP协议的即时消息服务端简单实现

    .net平台 基于 XMPP协议的即时消息服务端简单实现 昨天抽空学习了一下XMPP,在网上找了好久,中文的资料太少了所以做这个简单的例子,今天才完成.公司也正在准备开发基于XMPP协议的即时通讯工具 ...

  3. C++ 11 可变模板参数的两种展开方式

    #include <iostream> #include <string> #include <stdint.h> template<typename T&g ...

  4. Bounded Context

    From http://martinfowler.com/bliki/BoundedContext.html Bounded Context is a central pattern in Domai ...

  5. Oracle基础 存储过程和事务

    一.事务和存储过程 在存储过程中如何使用事务.当需要在存储过程中同时执行多条添加.修改.删除SQL语句时,为了保证数据完整性,我们需要使用事务.使用方式和在PL-SQL中非常相似,但也有一些区别. - ...

  6. InnoDB事务和锁

    InnoDB支持事务,MyISAM不支持事务. 一.事务的基本特性 ACID特性 1.原子性(Atomicity):事务是一个原子操作单元,其对数据的修改,要么全都执行,要么全都不执行. 2.一致性( ...

  7. mysql :安装过程中的问题

    安装mysql  选择路径的问题 出现如下问题:说明之前安装过mysql,写在的不干净

  8. centos安装postgresql

    #安装postgresqlyum -y install postgresql-server #执行数据库初始化脚本service postgresql-9.2 initdb #启动服务service ...

  9. unity3d WebPlayer版本号音效无声音问题

    unity web player,其是一款浏览器执行unity3d游戏引擎公布的游戏的插件,和Flash Player非常像,安全无毒应该是你玩某款网页游戏安装的.假设以后不玩了就能够卸载 Unity ...

  10. Weka学习之关联规则分析

    步骤: (一) 选择数据源 (二)选择要分析的字段 (三)选择需要的关联规则算法 (四)点击start运行 (五) 分析结果 算法选择: Apriori算法参数含义 1.car:如果设为真,则会挖掘类 ...