Swift 自定義tabBar

一、以storyboard的方式自定義tabBar

    let _width = self.view.frame.width
    let _height = self.view.frame.height - 49

    self.homeVc = UIStoryboard.init(name: "Home", bundle: nil).instantiateViewControllerWithIdentifier("home_sid") as? NavigationController
    self.homeVc!.view.frame = CGRectMake(0, 0, _width, _height)
    //注冊controller
    self.addChildViewController(self.homeVc!)

    self.discoverVc = UIStoryboard.init(name: "Discover", bundle: nil).instantiateViewControllerWithIdentifier("discover_sid") as? NavigationController
    self.discoverVc!.view.frame = CGRectMake(0, 0, _width, _height)
    self.addChildViewController(self.discoverVc!)

    self.messageVc = UIStoryboard.init(name: "Message", bundle: nil).instantiateViewControllerWithIdentifier("message_sid") as? NavigationController
    self.messageVc!.view.frame = CGRectMake(0, 0, _width, _height)
    self.addChildViewController(self.messageVc!)

    self.profileVc = UIStoryboard.init(name: "Profile", bundle: nil).instantiateViewControllerWithIdentifier("profile_sid") as? NavigationController
    self.profileVc?.view.frame = CGRectMake(0, 0, _width, _height)
    self.addChildViewController(self.profileVc!)

    self.view.addSubview(self.homeVc!.view)
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

  • 仿映客tabbar 創(chuàng)建一個繼承自UIView的自定義類 CustomTabBar.swift 創(chuàng)建繼承自UITa...
    Lucifer_rcy閱讀 843評論 0 1
  • 發(fā)現(xiàn) 關注 消息 iOS 第三方庫、插件、知名博客總結 作者大灰狼的小綿羊哥哥關注 2017.06.26 09:4...
    肇東周閱讀 15,291評論 4 61
  • 親愛的喵,如果有一天我需要你來照顧,你也會像我寵你那樣寵我吧! 小時候一邊唱著“一個老丁頭,欠我倆榴榴,我說三天還...
    一場大雪閱讀 277評論 0 0
  • 窗外 晴空萬里 藍天白云編織出 絢麗的風景 探出頭去 還是不夠盡興 轉身 開門 噔噔噔跑下樓去 拉開大門 正要擁抱...
    紫郁0720閱讀 282評論 5 4
  • 修改postgresql.conf postgresql.conf存放位置在/etc/postgresql/9.x...
    我的名字叫浩仔閱讀 4,965評論 0 0

友情鏈接更多精彩內容