[Swift]LaunchScreen.storyboard設置啟動頁!注意:UILaunchImages已被iOS棄用,請使用LaunchScreen.storyboard。


★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
➤微信公眾號:山青詠芝(shanqingyongzhi)
➤博客園地址:山青詠芝(https://www.cnblogs.com/strengthen/ 
➤GitHub地址:https://github.com/strengthen/LeetCode
➤原文地址:https://www.cnblogs.com/strengthen/p/10636993.html 
➤如果鏈接不是山青詠芝的博客園地址,則可能是爬取作者的文章。
➤原文已修改更新!強烈建議點擊原文地址閱讀!支持作者!支持原創!
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★

設置【LaunchScreen.storyboard】,勾選【Use as Launch Screen】,

【LaunchScreen.storyboard】中添加兩個imageView:背景圖ImageView、圖標ImageView。啟動時即可顯示啟動圖!

 

 注意這幾個地方:特別是Xcode版本

 

 

 


 

在【AppDeleaget.swift】設置啟動頁的時長:

1 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
2         // Override point for customization after application launch.
3         //在頂部狀態欄顯示風火輪
4         UIApplication.shared.isNetworkActivityIndicatorVisible = true
5         //啟動頁顯示時間3s
6         Thread.sleep(forTimeInterval: 3)
7         UIApplication.shared.isNetworkActivityIndicatorVisible = false
8         return true
9     }

點擊查看:【LaunchScreen.storyboard如何跳轉到到Main.storyboard】

注意選項:【Project Format】的設置

重要提示:如果Run后啟動頁不顯示,把項目從模擬器或真機上刪除,重新Run一次。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM