自定义启动页/广告页

作者: 75afc06dcc73 | 来源:发表于2016-11-28 14:10 被阅读184次

先看一下效果图再说别的吧(ps:现已改成倒计时为0时直接取消,不显示0)


默认.gif
放大.gif
缩小.gif
横切.gif
本地图片.gif
GIF.gif

将Demo中的DWLaunchScreen文件夹拖入到您的工程中

使用准备.png

在info.plist中加入两个key,全部为BOOL类型

View controller-based status bar appearance  值为NO   Status bar is initially hidden  值为YES
infoPlist.png

在AppDelegate.m中引入头文件

#import "DWLaunchScreen.h"
头文件.png

如果为Image对象并且需要点击则需要设置代理

<DWLaunchScreenDelegate>

在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法中加入以下代码

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

self.window.rootViewController = [[ViewController alloc] init];

self.window.backgroundColor = [UIColor whiteColor];

[self.window makeKeyAndVisible];

//    [NSThread sleepForTimeInterval:1.25f];

DWLaunchScreen *launch = [[DWLaunchScreen alloc] init];

//设置代理,只有图片格式需要点击时才需设置
launch.delegate = self;

//设置显示时长
launch.accordingLength = 3.0;

//设置消失耗时
launch.deleteLength = 3.0f;

//消失方式
launch.disappearType = DWCrosscutting;

//是否隐藏按钮
//    launch.skipHide = YES;

//按钮显示文字
launch.skipString = @"等待:";

//字体颜色
launch.skipTitleColor = [UIColor blackColor];

//字体大小
launch.skipFont = 18;

//按钮背景颜色
launch.skipBgColor = [UIColor orangeColor];

//按钮显示位置
launch.skipLocation = LeftTop;

//网络时的渲染图,建议与启动图相同
launch.logoImage = [UIImage imageNamed:@"bg.jpg"];

//    NSString格式
//        [launch dw_LaunchScreenContent:@"https://www.baidu.com" window:self.window withError:^(NSError *error) {
//    
//             NSLog(@"error:%@", error);
//    
//        }];


//    UIImage格式
//        [launch dw_LaunchScreenContent:[UIImage imageNamed:@"cat.jpeg"] window:self.window withError:^(NSError *error) {
//    
//            NSLog(@"error:%@", error);
//    
//        }];
//    

//    NSURL格式
[launch dw_LaunchScreenContent:[NSURL URLWithString:@"https://www.baidu.com"] window:self.window withError:^(NSError *error) {
    
    NSLog(@"error:%@", error);

}];

return YES;

#pragma mark ---点击了图片,只有图片格式时才生效

- (void)dw_didSelectImageView {

NSLog(@"点击了图片");

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"点击了图片" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}

使用中如果遇到问题可以Issues我

Github:https://github.com/dwanghello/DWLaunchScreenTest

使用中如果遇到什么问题可以联系我

QQ:739814184

微信:ai739814184

QQ群:577506623

e-mail:dwang.hello@outlook.com

相关文章

  • 自定义启动页/广告页

    先看一下效果图再说别的吧(ps:现已改成倒计时为0时直接取消,不显示0) 将Demo中的DWLaunchScree...

  • APP自定义广告页、启动页、欢迎页等技巧

    像APP启动页、广告页的切换模式最好使用通知,并且在使用通知的时候,比较好的做法是在appdelegate中添加a...

  • 启动页+广告页实现优化

    前言 每个app中都有启动+广告这个功能逻辑,或多或少,每个公司的逻辑都不大一样,最近我优化了一版广告业+启动页面...

  • iOS 广告页的实现

    现象: 诚然、现在很多app启动后除了启动页,还会加一个广告页。今天我们就来说下广告页的实现。 分析(3部分组成)...

  • iOS广告页的实现及注意点

    在大多数app启动过程中都会出现广告页,那么现在说说到底是如何实现的。 实现思路: 自定义一个广告页viewCon...

  • 启动launchOptions

    给启动页加上一页广告页,在收到通知跳应用是,不走启动页的rootvc设置方法。 做的判断是if(launchOpt...

  • 【Android】隐藏底部虚拟按键

    Android隐藏底部虚拟按键 使用场景:欢迎页 启动页 广告页 展示页... Google的官方文档是: htt...

  • 启动页广告设置

    策略 这么晚了,还是直接上代码吧 contrller的代码 最主要的代码都在了,意会吧

  • Android启动广告页

    需求:在App应用退出后(此时App是在后台运行的,并不是进程被杀死),每当用户再次将该应用切换到前台显示时,总能...

  • iOS 启动页广告

    思路1.判断广告文件是否存在,以及初始化广告位2.无论沙盒中是否存在广告图片,都需要重新调用获取广告接口,判断广告...

网友评论

本文标题:自定义启动页/广告页

本文链接:https://www.haomeiwen.com/subject/bodopttx.html