博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
创建一个没有边框的并添加自定义文字的UISegmentedControl
阅读量:4633 次
发布时间:2019-06-09

本文共 1024 字,大约阅读时间需要 3 分钟。

//个性推荐 歌单 主播电台 排行榜    NSArray* promoteArray=@[@"个性推荐",@"歌单",@"主播电台",@"排行榜"];    UISegmentedControl* promoteSgement=[[UISegmentedControl alloc]initWithItems:promoteArray];    promoteSgement.frame=CGRectMake(0, 64, screenWidth, 40);    [promoteSgement setSelectedSegmentIndex:0];//默认选择第一个    promoteSgement.tintColor = [UIColor clearColor];//去掉颜色 现在整个segment都看不见    NSDictionary* selectedTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:15],NSForegroundColorAttributeName:[UIColor colorWithRed:212/256.0 green:21/256.0 blue:10/256.0 alpha:1]};    [promoteSgement setTitleTextAttributes:selectedTextAttributes forState:UIControlStateSelected];//设置选择时文字的属性    NSDictionary* unselectedTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:15],NSForegroundColorAttributeName: [UIColor blackColor]};    [promoteSgement setTitleTextAttributes:unselectedTextAttributes forState:UIControlStateNormal];//设置未选择时文字的属性    [self.view addSubview:promoteSgement];

 

转载于:https://www.cnblogs.com/death3721/p/5013268.html

你可能感兴趣的文章
16个时髦的扁平化设计的 HTML5 & CSS3 网站模板
查看>>
could not instantiate class [com.jinqing.cashier.entity.abstractVO.TradeItemVO] from tuple
查看>>
Java_JVM参数-XX:MaxDirectMemorySize 与 两种 ByteBuffer: heap,direct ByteBuffer
查看>>
【转载】HBase Region重点剖析
查看>>
Linux系统添加路由条目信息
查看>>
Php—AJAX跨域问题
查看>>
谈到电影,我们收获了什么
查看>>
设置CentOS开机连接网络 Centos 开机启动网卡的设置方法
查看>>
1.12Linux下软件安装(学习过程)
查看>>
七:初探异步编程
查看>>
Shell编程之if语句实战(详解)
查看>>
OAuth 2.0 学习
查看>>
PHP 常用的header头部定义汇总
查看>>
测试虚线
查看>>
Codeforces Round #296 (Div. 2) B. Error Correct System
查看>>
python之列表生成式
查看>>
小程序开发 自定义转发
查看>>
【找回数学的感觉】1 再版汉诺塔等
查看>>
3. Longest Substring Without Repeating Characters
查看>>
我的一亩三分地
查看>>