1. 程式人生 > >iOS開發之Swift標籤欄按鈕UITabBarItem樣式修改(圖示文字尺寸,顏色等)

iOS開發之Swift標籤欄按鈕UITabBarItem樣式修改(圖示文字尺寸,顏色等)

import UIKit
 
class MainTabViewController:UITabBarController
{
    override func viewDidLoad()
    {
        super.viewDidLoad()
        // 一共包含了兩個檢視
        let qqView = View1ViewController()
        qqView.title = "QQ"
        let androidView = View1ViewController()
        androidView.title = "skype"
         
        // 分別宣告兩個檢視控制器
        let qq = UINavigationController(rootViewController:qqView)
        qq.tabBarItem.image = UIImage(named:"qq")
        let android = UINavigationController(rootViewController:androidView)
        android.tabBarItem.image = UIImage(named:"skype")
        self.viewControllers = [qq,android]
              
        // 預設選中的是qq檢視
        self.
select
edIndex = 0
    }
}