zoukankan      html  css  js  c++  java
  • UIBarItem 的设置

    常见设置如下

    #import "TRTabBarController.h"

    @interface TRTabBarController ()<TRtabBarDelegate>

    @end

    @implementation TRTabBarController

       //设置选中后的背景图
        [self.tabBar setSelectionIndicatorImage:[UIImage imageNamed:@"delete_btn"]];
       

    //遍历tabVarControoler 中的子视图,来改变样式
        for (UIViewController*vc in self.viewControllers) {
        //读取设置过的选中图片
            vc.tabBarItem.selectedImage=[vc.tabBarItem.selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
            //设置vc的tabbarItem的文字样式
            UITabBarItem*baritem=vc.tabBarItem;
            //设置item的文字位置
            [baritem setTitlePositionAdjustment:UIOffsetMake(0, -2)];
            //字体变大
           NSMutableDictionary *nomalattributes=[NSMutableDictionary dictionary];
            nomalattributes[NSFontAttributeName]=[UIFont systemFontOfSize:13];
            nomalattributes[NSForegroundColorAttributeName]=[UIColor colorWithRed:128/255.0 green:128/255.0 blue:128/255.0 alpha:1];
            [baritem setTitleTextAttributes:nomalattributes forState:UIControlStateNormal];
            
            
            NSMutableDictionary *selectedAttributes2=[NSMutableDictionary dictionary];
            selectedAttributes2[NSFontAttributeName]=[UIFont systemFontOfSize:13];
           selectedAttributes2[NSForegroundColorAttributeName]=[UIColor colorWithRed:8/255.0 green:232/255.0 blue:13/255.0 alpha:1];
            [baritem setTitleTextAttributes: selectedAttributes2 forState:UIControlStateSelected];

    追寻最真
  • 相关阅读:
    Nginx和PHP-FPM的启动、重启、停止脚本分享
    [Linux]Fedora19修复被Windows干掉的引导
    [Linux]RHEL/CentOS6配置tomcat使用80端口(与httpd整合)
    [Linux]SAMBA共享打印机
    [Linux]配置Logwatch使用第三方smtp发送电子邮件
    [oVirt]在双网卡网络环境下使用oVirt LiveCD
    走进Linux世界主题讲座纪录
    mysql用户及权限复制
    记一次失败的K8S安装部署
    HTTP状态码与爬虫
  • 原文地址:https://www.cnblogs.com/zhao-jie-li/p/5061136.html
Copyright © 2011-2022 走看看