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升级步骤

    ES从1.2.1升级到1.4.0 升级步骤,基本上是按照官网的叙述来完成的,链接是:http://www.elasticsearch.org/guide/en/elasticsearch/refere ...

  2. How to check the 'OLE DB Destination' INPUT and OUTPUT

    Step 1: Step 2: Step 3:

  3. linux 设置时间

    1.图形界面里面点击右上角的 “时间” 2.设置,edit 找到china G8区 date发现还没有生效 3.reboot 重启才生效了

  4. Odoo12 重大改变

    Table of Contents 重构的功能 ORM 数据导入 库存 库存规则 MRP 多步路线 新功能 IoT     Odoo12 预计 2018/10 在 Odoo experience 20 ...

  5. Acceptor-Connector模式一(Acceptor的工作)V2.0

    前言:ACE Acceptor-Connector模式 首先这样的模式肯定是面向连接的TCP/IP协议. 无论是什么场景.差点儿面向连接的通信程序总是由一端主动发起连接,一端监听等待对方的连接. 这就 ...

  6. 解决cp: omitting directory 提示信息

    解决cp: omitting directory 提示信息 执行cp时出现“cp: omitting directory ” 提示信息, 可以使用cp -r 参数来递归拷贝这些文件.

  7. ios侧滑返回:完美解决 interactivePopGestureRecognizer 卡住的问题

    interactivePopGestureRecognizer是iOS7推出的解决VeiwController滑动后退的新功能,虽然很实用,但是坑也很多啊(比如在rootViewcontroller下 ...

  8. UUID(即GUID)

    UUID(GUID)是Cocoa Touch提供的一种生成唯一标识的机制.类型为CFUUIDRef的对象可以代表UUID,UUID是基于当前时间.计数器和硬件标识(通常是以太网卡的MAC地址)等数据计 ...

  9. js获取时间查并实现倒计时读条

    <script type="text/javascript"> $().ready(function () {// 每增加一个切换,就要增加一行,tab1不变,其他的都 ...

  10. 深入理解dp px density

    1 http://blog.csdn.net/lcaihy1314/article/details/8446401 2 待续