美文网首页
UISegment 设置样式(背景颜色,字体颜色)

UISegment 设置样式(背景颜色,字体颜色)

作者: 原味丿丿咖啡Vitas | 来源:发表于2019-03-08 17:54 被阅读0次
    self.segment.tintColor = [UIColor colorWithRGB:0xE8985E];
    self.segment.layer.cornerRadius = 17.0;
    self.segment.clipsToBounds = YES;
    [self.segment setBackgroundImage:[UIImage imageWithColor:[UIColor colorWithRGB:0xDEDEDE]] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    [self.segment setBackgroundImage:[UIImage imageWithColor:[UIColor colorWithRGB:0xE8985E]] forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
    NSDictionary *normalDic = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRGB:0x999999],NSForegroundColorAttributeName,nil];
    [self.segment setTitleTextAttributes:normalDic forState:UIControlStateNormal];
    NSDictionary *selectDic = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil];
    [self.segment setTitleTextAttributes:selectDic forState:UIControlStateSelected];

效果如下

image.png

相关文章

  • UISegment 设置样式(背景颜色,字体颜色)

    效果如下

  • css

    设置背景或者文本颜色 图像背景 重复背景图片 水平和垂直重复背景图片 文本颜色 字体样式

  • 导航栏UINavigationController

    2,设置导航栏的背景颜色 3,设置导航栏按钮字体颜色 4,设置标题样式与颜色(通过导航栏字典的方式) 5,设置返回...

  • 2017-12-30-WEB预习第一天-CSS

    CSS叫做层叠样式表,用来设置页面中元素的样式。背景颜色、字体颜色、字体大小。CSS负责结构、表现、行为中的表现。...

  • HTML

    一. CSS 1.CSS叫做层叠样式表,用来设置页面中元素的样式。背景颜色、字体颜色、字体大小2.CSS负责结构、...

  • 《macOS开发》自定义控件之NSButton

    控件功能简介:1. 可设置(默认/选中)背景(图片/颜色)2. 可设置(默认/选中)文字(内容/颜色/字体样式)4...

  • html、css学习笔记(六)

    颜色设置:有字体颜色(color)、背景颜色(background-color)、边框颜色(border)等,设置...

  • UISearchBar

    设置UISearchBar中 placeholder颜色 placeholder 输入字体颜色 背景颜色 清除按钮颜色

  • CSS入门

    主要作用:给HTML网页设置外观或者样式 网页中文字的大小、颜色、字体、背景颜色、背景图片 属性值不添加引号 区别...

  • OC-UITabBar上相关设置

    去掉黑线 自定义黑线颜色 设置背景色 自定义背景图片 设置字体偏移 字体 未选中颜色 选中颜色 注意:有点设置无限...

网友评论

      本文标题:UISegment 设置样式(背景颜色,字体颜色)

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