美文网首页
Swift 自定义tabBar

Swift 自定义tabBar

作者: iOS_开发 | 来源:发表于2017-06-11 20:13 被阅读0次

    一、以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)
    

    相关文章

      网友评论

          本文标题:Swift 自定义tabBar

          本文链接:https://www.haomeiwen.com/subject/pfbnattx.html