zoukankan      html  css  js  c++  java
  • 标签控制器UITabBarController

    (一)定义:与导航控制器类似,标签控制器也是一个容器类。不用的是,这个不存在层级关系。你控制器有多少个ViewController,就会一直存在这么多个。不会被释放。

    (二)UIBarButtonItem是一个模型,来控制整体TabBar样式。

    (三)基本实现:

     ///  这里设置初始启动后,有四个页面
            addChildViewController(HMHomeTableViewController(), title: "首页", imageName: "tabbar_home")
            addChildViewController(HMMessageTableViewController(), title: "消息", imageName: "tabbar_message_center")
            addChildViewController(HMDiscoverTableViewController(), title: "发现", imageName: "tabbar_discover")
            addChildViewController(HMProfileTableViewController(), title: "", imageName: "tabbar_profile")
     ///  添加四个子控制器
        ///
        ///  - parameter childController: 控制器名称
        ///  - parameter imageName:       tabBarItem图片
        ///  - parameter titleName:       tabBarItem名称
        func addChildViewController(childController: UIViewController , title: String, imageName: String) {
            // 设置颜色
            // 修改成自己的   
            childController.tabBarItem = HMTabBarItem()
            childController.tabBarItem.setTitleTextAttributes([NSFontAttributeName:UIFont.systemFontOfSize(10)], forState: .Normal)
            childController.tabBarItem.setTitleTextAttributes([NSFontAttributeName:UIFont.systemFontOfSize(22)], forState: .Selected)
            childController.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.orangeColor()], forState: .Selected)
            childController.tabBarItem.title = title
            childController.tabBarItem.image = UIImage(named: imageName)?.imageWithRenderingMode(.AlwaysOriginal)
            childController.tabBarItem.selectedImage = UIImage(named:"(imageName)_selected")?.imageWithRenderingMode(.AlwaysOriginal)
            let nav = HMNavgationController(rootViewController: childController)
            childController.navigationItem.title = title
            addChildViewController(nav)
        }
  • 相关阅读:
    wx.Notebook
    wx.button
    wxpython wx.windows的API
    wxpython Menus and toolbars
    使用 profile 进行python代码性能分析
    html 表格边框的设置
    Java IO方式
    Java文件拷贝方式
    S.O.L.I.D原则
    面向对象设计
  • 原文地址:https://www.cnblogs.com/sgxx/p/5828736.html
Copyright © 2011-2022 走看看