美文网首页
swift tabbar框架

swift tabbar框架

作者: func_老衲姓罗 | 来源:发表于2016-11-21 10:48 被阅读0次

    github地址:https://github.com/DreamingLuo/LGTabbar

    封装了两个方法

    private func addChildViewControllers() {

    addChildViewController(FirstViewController(), title: "首页", imageName: "shouye.png", selectedImageName: "shouye1.png")

    addChildViewController(SecondViewController(), title: "部门", imageName: "luru.png", selectedImageName: "luru1.png")

    addChildViewController(ThirdViewController(), title: "图表", imageName: "tubiao.png", selectedImageName: "tubiao1.png")

    addChildViewController(FourthViewController(), title: "我的", imageName: "wode.png", selectedImageName: "wode.png")

    }

    func addChildViewController(childController: UIViewController, title: String, imageName: String, selectedImageName: String) {

    childController.tabBarItem.image = UIImage(named: imageName)

    childController.tabBarItem.selectedImage = UIImage(named: selectedImageName)

    childController.title = title

    let nav = UINavigationController(rootViewController: childController)

    addChildViewController(nav)

    }

    实现点击每个item切换页面并改变item颜色

    相关文章

      网友评论

          本文标题:swift tabbar框架

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