zoukankan      html  css  js  c++  java
  • navigation和tabbar上的文字.图片 自定义

    [[UITabBarItem appearance] setTitleTextAttributes:@{ UITextAttributeTextColor : [UIColor blackColor],UITextAttributeFont:[UIFont fontWithName:@"Marion-Italic" size:14.0]}           forState:UIControlStateNormal];

    UIControState的设置:

    UIControlStateNormal:未被选中时;

    UIControlStateHighlighted:被选中的时候;

    navigation和tabbar上的文字.图片

     [self.navigationController.tabBarItem setTitlePositionAdjustment:UIOffsetMake(15, -10)];

     uitabbaritem.imageInsets

    // 导航底部线条颜色

        [self.navigationController.navigationBar setBackgroundImage:[self imageWithColor:[UIColor clearColor]]

                           forBarPosition:UIBarPositionAny

                               barMetrics:UIBarMetricsDefault];

        [self.navigationController.navigationBar setShadowImage:[UIImage new]];

     // 去除tabbar顶部黑线

      1.

      CGRect rect = CGRectMake(0, 0, SCREEN_WIDTH, tabbarVC.view.frame.size.height);

        UIGraphicsBeginImageContext(rect.size);

        CGContextRef context = UIGraphicsGetCurrentContext();

        CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);

        CGContextFillRect(context, rect);

        UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

        UIGraphicsEndImageContext();

        [tabbarVC.tabBar setBackgroundImage:img];

        [tabbarVC.tabBar setShadowImage:img];

     

      2.

        tabbarVC.tabBar.barStyle                    = UIBarStyleBlack; 

         tabbarVC.tabBar.translucent                 = YES; // 这句话是加透明效果的。

    // 返回一张纯色图片

    - (UIImage *)imageWithColor:(UIColor *)color

    {

        CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);

        UIGraphicsBeginImageContext(rect.size);

        CGContextRef context = UIGraphicsGetCurrentContext();

        

        CGContextSetFillColorWithColor(context, [color CGColor]);

        CGContextFillRect(context, rect);

        

        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

        UIGraphicsEndImageContext();

        

        return image;

    }

  • 相关阅读:
    xss学习笔记
    【转】Python中的正则表达式(re)
    数据隐藏技术揭秘笔记
    几道排列组合题的总结
    Notepad++来比较文件
    快捷键总结
    进制转换
    leetcode刷题(三)
    leetcode刷题(二)
    leetcode刷题(一)
  • 原文地址:https://www.cnblogs.com/shifu/p/5726412.html
Copyright © 2011-2022 走看看