TBVideoSplashScreen 0.1.1

TBVideoSplashScreen 0.1.1

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布时间上次发布2015年7月
SPM支持 SPM

Terry Bu 维护。



  • 作者:
  • Terry Bu

此库适用于任何希望用视频而不是无聊的静态启动图像作为启动画面的 iOS 开发者。

在您的 AppDelegate.swift 中,导入 TBVideoSplashScreen 并在 didFinishLaunchingWithOptions 中遵循下面的代码。传递给 makeAndPlayVideoSplashScreen 的启动图像是为了最佳视觉体验。获取您视频的第一帧并将其作为静态图像设置。当您的视频加载时,该启动图像将被展示给用户,给人一种视频加载略快的感觉

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.

    TBVideoSplashScreen.makeAndPlayVideoSplashScreen(self, videoNameString: "splashScreen", withExtension: "mp4", launchImageString: "launchScreenImage")

    return true
}

确保您在本文件中实现了 @objc moviePlayBackDidFinish() 作为回调方法。这是视频播放完成时自动触发的函数。

@objc
func moviePlayBackDidFinish() {
    //any custom logic for callback goes here
    let vc: UIViewController =  UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("ViewController") as! UIViewController
    let navCtrl = UINavigationController(rootViewController: vc)
    window?.rootViewController! = navCtrl
    NSNotificationCenter.defaultCenter().removeObserver(self)
}

用法

要运行示例项目,首先克隆仓库,然后在 Example 目录中运行 pod install

要求

安装

TBVideoSplashScreen 可以通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile 中

pod "TBVideoSplashScreen"

作者

Terry Bu, [email protected]

许可证

TBVideoSplashScreen 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。