• ZLaunchAdVCIntegrated launch AD supportLaunchImageandLaunchScreen, support GIF, support local pictures, support view transition animation
  • useviewControllerDo launch page ads by switchingrootViewController, avoid flashing the home controller, avoid dealing with complex hierarchical relationships
  • Making: https://github.com/MQZHot/ZLaunchAdVC deficiency, welcome exchange, welcome star ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨
  • Update: the 2017-11-10

function

  • Support for image caching
  • Support for custom skip buttons
  • Support network/local resources, support GIF image display
  • LaunchImage and launchscreen.storyboard are supported.
  • Support status bar color setting, display and hide
  • Support for AD click events
  • Support AD completion animation Settings
pic0.gif

use

  • didFinishLaunchingWithOptionsSet in theZLaunchAdVCforrootViewController, specify the controller to display after the advertisement is completed, and configure the parameters to use the advertisement
  • The configuration of each advertisement display can be unified or configured through network data, such as button appearance, picture size and animation
  • You can also flexibly configure whether to display ads when launching with push or DeepLink

    /// load ads
    let adVC = ZLaunchAdVC(waitTime: 4,rootVC: nav)
    request { model in
      adVC.configure { button, adView in
    
          button.skipBtnType = model.skipBtnType
          adView.animationType = model.animationType
          adView.adFrame = CGRect(x: 0, y: 0, width: Z_SCREEN_WIDTH, height: Z_SCREEN_WIDTH*model.height/model.width)
    
      }.setImage(model.imgUrl, duration: model.duration, options: .readCache, action: {
    
          let vc = UIViewController()
          vc.view.backgroundColor = UIColor.yellow homeVC.navigationController? .pushViewController(vc, animated:true) }) } window? .rootViewController = adVCCopy the code

    AD configuration

  • throughconfigureMethod To configure advertising parameters,configureAs a closure
  • Closure parameter 1: Skip button configuration
    /// Button position
    var frame = CGRect(x: Z_SCREEN_WIDTH - 70,y: 42, width: 60,height: 30)
    /// Background color
    var backgroundColor = UIColor.black.withAlphaComponent(0.4)
    / / / text
    var text: NSString = "Skip"
    /// font size
    var textFont = UIFont.systemFont(ofSize: 14)
    /// font color
    var textColor = UIColor.white
    /// Number size
    var timeFont = UIFont.systemFont(ofSize: 15)
    /// Number color
    var timeColor = UIColor.red
    /// skip button types
    var skipBtnType: ZLaunchSkipButtonType = .textLeftTimerRight
    /// circle progress color
    var strokeColor = UIColor.red
    /// circle width
    var lineWidth: CGFloat = 2
    / / / rounded corners
    var cornerRadius: CGFloat = 5
    /// frame color
    var borderColor: UIColor = UIColor.clear
    /// frame width
    var borderWidth: CGFloat = 1Copy the code
  • Closure parameter 2: Configure the AD image size – complete the animation
    /// AD image size
    var adFrame = CGRect(x: 0, y: 0, width: Z_SCREEN_WIDTH, height: Z_SCREEN_HEIGHT-100)
    /// transition animation
    var animationType: ZLaunchAnimationType = .crossDissolveCopy the code

    Loading pictures

  • Loading network images

    let url = "http://chatm-icon.oss-cn-beijing.aliyuncs.com/pic/pic_20170724152928869.gif"
    adVC.setImage(url, duration: 5, options: .readCache, action: {
      /// do something
    })Copy the code
  • Setting local Images

    adVC.setImage(UIImage(named: "222"), duration: 7, action: {
      /// do something
    })Copy the code
  • Set up local GIF
    adVC.setGif("111", duration: 7, action: {
     /// do something
    })Copy the code

Rely on

  • useSwiftHashEnabling MD5 Encryption

    Status bar Settings

PNG status bar Settings