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)
        }
  • 相关阅读:
    使用logstash迁移elasticsearch
    cratedb 4.2.1单机安装
    es6.8.5集群部署(使用x-pack ssl方式)
    es从6.5升级到6.8(单节点)
    elasticsearch-6.8.5单机部署(当生产环境使用)
    mysql_upgrade升级(主从模式,先升级从库)
    mysql_upgrade升级(直接本地升级)
    主从数据不一致导出同步错误(从库记录存在导致写入报主键重复)
    12C下使用logminer
    mysql主库磁盘空间爆满导致从库错误
  • 原文地址:https://www.cnblogs.com/sgxx/p/5828736.html
Copyright © 2011-2022 走看看