怎么樣乒躺,這款自定義的Tab Bar漂亮吧澡谭!
接下來(lái)就教大家如何快速集成
依然是幾句代碼就可以搞定
首先溃肪,將我Demo中的TabBar文件夾拖入到你的工程中。
之后在A(yíng)ppDelegate中創(chuàng)建
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
/*初始化window*/
self.window = UIWindow.init(frame: UIScreen.mainScreen().bounds)
self.window!.backgroundColor = UIColor.whiteColor()
self.window!.makeKeyAndVisible()
/*創(chuàng)建一個(gè)自定義TabBar控制器*/
let tabController = FNFoldingTabBarController()
tabController.tabBarBgColor = UIColor.clearColor()
tabController.title = "自定義TabBar"
/*初始化4個(gè)視圖(在這之前先創(chuàng)建4個(gè)UIViewController類(lèi))*/
let vc0 = ViewController0()
let vc1 = ViewController1()
let vc2 = ViewController2()
let vc3 = ViewController3()
/*將4個(gè)視圖添加到TabBar控制器上*/
tabController.fn_viewControllers = [vc0,vc1,vc2,vc3]
/*創(chuàng)建一個(gè)導(dǎo)航控制器*/
let nav = UINavigationController(rootViewController: tabController)
nav.navigationBar.barTintColor =
UIColor(red: 102/255, green: 204/255, blue: 204/255, alpha: 1)
nav.navigationBar.titleTextAttributes =
[NSForegroundColorAttributeName: UIColor.whiteColor()]
/*設(shè)置啟動(dòng)項(xiàng)*/
self.window?.rootViewController = nav
self.window?.makeKeyAndVisible()
return true
}
好了,就是這么簡(jiǎn)單
喜歡的話(huà),別忘了點(diǎn)擊上方的關(guān)注按鈕蔫耽,更多精彩盡在我的簡(jiǎn)書(shū)博客
最后附上Demo地址https://pan.baidu.com/s/1o7HrYY2