github: https://github.com/MQZHot/ZLaunchAdVC
欢迎star✨✨✨✨✨✨✨✨✨✨✨✨✨
功能圆形进度跳过、倒计时跳过
广告图大小设置
自定义跳过按钮,自定义位置、大小、颜色。。。
支持状态栏颜色设置、显示与隐藏
支持本地图片显示
支持GIF图片显示
使用1.基本使用func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { window = UIWindow.init(frame: UIScreen.main.bounds) window?.backgroundColor = UIColor.white let homeVC = ViewController() let nav = UINavigationController.init(rootViewController: homeVC) if launchOptions != nil { /// 通过推送等启动 window?.rootViewController = nav } else { /// 正常点击icon启动,加载广告 let adVC = ZLaunchAdVC().adBottom(200).transition(.filpFromLeft).configRootVC(nav) request(completion: { (url, duration) in adVC.configNetImage(url: url, duration: duration, adImgViewClick: { let vc = UIViewController() vc.view.backgroundColor = UIColor.yellow homeVC.navigationController?.pushViewController(vc, animated: true) }) }) window?.rootViewController = adVC } window?.makeKeyAndVisible() return true } /// 网络请求 func request(completion: @escaping (_ url: String, _ duration: Int)->()) -> Void { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2, execute: { let url = '' let adDuartion = 8 completion(url, adDuartion) }) }2. 默认显示时间、广告图大小、过渡类型 配置/// defaultDuration: 未设置广告/广告加载不出来时,VC的显示时间,开题报告,默认3s /// adViewBottom: 图片距离底部距离,默认100 /// transitionType: 过渡类型,论文,默认fade let adVC = ZLaunchAdVC(defaultDuration: 3, adViewBottom: 200, transitionType: .filpFromBottom, rootViewController: nav) /// 或者 let adVC = ZLaunchAdVC().adBottom(200).transition(.filpFromLeft).rootVC(nav) 3. 跳过按钮配置adVC.configSkipBtn({ (config) in config.backgroundColor = UIColor.red config.centerX = 100 config.centerY = 200 config.skipBtnType = .circle config.strokeColor = UIColor.green }) 4. 加载本地图片4.1 本地图片 adVC.configLocalImage(image: UIImage(named: '222'), duration: 7, adImgViewClick: { /// do something }) 4.2 本地GIFadVC.configLocalGif(name: '111', duration: 7, adImgViewClick: { /// do something })