SWIFT-获取启动图片
作者:
镜花水月忆存逝兮 | 来源:发表于
2020-07-28 09:51 被阅读0次// 获取启动图
class func launchImage() -> UIImage? {
var lauchImage: UIImage!
var viewOrientation: String!
let viewSize = UIScreen.main.bounds.size
let orientation: UIInterfaceOrientation = UIApplication.shared.statusBarOrientation
if orientation == .landscapeLeft || orientation == .landscapeRight {
viewOrientation = "Landscape"
}else{
viewOrientation = "Portrait"
}
let imagesInfoArray = Bundle.main.infoDictionary!["UILaunchImages"]
for dict: Dictionary<String, Any> in imagesInfoArray as! Array {
let image = UIImage(named: dict["UILaunchImageName"] as! String)
let imageSize = CGSize(width: image?.size.width ?? 0, height: image?.size.height ?? 0)
if imageSize.equalTo(viewSize) && viewOrientation == dict["UILaunchImageOrientation"]! as? String {
lauchImage = image
}
}
return lauchImage
}
本文标题:SWIFT-获取启动图片
本文链接:https://www.haomeiwen.com/subject/ctnxrktx.html
网友评论