启动图片和启动广告设置

(1)首先是启动图片:http://www.360doc.com/content/16/0320/20/10408243_543891288.shtml

把上面的设置图片,下面的清空,如图


另外要把LaunchScreen.storyboard的use as launch screen选项取消掉,运行就可以了。

注意要把原来的app删除再安装,否则无效

(2)启动广告,这里用的是一个第三方库,github地址:https://github.com/CoderZhuXH/XHLaunchAd

使用的话在app delegate中导入头文件

#import <XHLaunchAd/XHLaunchAd.h>

didFinishLaunchingWithOptions

[XHLaunchAd showWithAdFrame:CGRectMake(0, 0,self.window.bounds.size.width, self.window.bounds.size.height) setAdImage:^(XHLaunchAd *launchAd) {

        

        //未检测到广告数据,启动页停留时间,默认3,(设置4即表示:启动页显示了4s,还未检测到广告数据,就自动进入window根控制器)

        //launchAd.noDataDuration = 4;

        

        //广告图片地址

        NSString *imgUrl = @"http://c.hiphotos.baidu.com/image/pic/item/d62a6059252dd42a6a943c180b3b5bb5c8eab8e7.jpg";

        //广告停留时间

        NSInteger duration = 6;

        //广告点击跳转链接

        NSString *openUrl = @"http://www.baidu.com";

        

        //2.设置广告数据

        [launchAd setImageUrl:imgUrl duration:duration skipType:SkipTypeTimeText options:XHWebImageDefault completed:^(UIImage *image, NSURL *url) {

            

            //异步加载图片完成回调,若需根据图片尺寸,刷新广告frame,可在这里操作

            //launchAd.adFrame = ...;

            

        } click:^{

            

            //广告点击事件

            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:openUrl]];

            

        }];

        

    } showFinish:^{

        

//        //广告展示完成回调,设置window根控制器

        self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[UIViewController alloc] init]];


    }];


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值