一、以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)
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。