我已經從主檔案(XCode 14.1)手動添加了一個標簽欄控制器。我認為這是主要故事板

兩個專案場景都有自己的控制器類(自定義類)。
在任一類中,我都想更改專案影像和標題。對于這個問題,影像。在相應的場景類(ProfileViewController)之一內部:
override func viewDidLoad() {
super.viewDidLoad()
// Does nothing (both)
self.tabBarController?.tabBar.items![1].image = UIImage(named: "square.and.arrow.up.circle")
self.tabBarItem.image = UIImage(named: "square.and.arrow.up.circle")
}
我想以編程方式更改影像,因為對于其中一個選項卡,我從外部獲取影像。
uj5u.com熱心網友回復:
您創建的影像不正確。要使用您需要使用的 SF 符號之一:
UIImage(systemName: "square.and.arrow.up.circle")
UsingUImage(named:)嘗試從您的資源包或影像資產中加載影像。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/532906.html
標籤:IOS迅速
