UIlabel 设置圆角 自定义颜色 字体居中
2016-03-30 11:17
429 查看
创建一个label
Uilabel * tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.width/2-50, 165, 100, 30)];
设置自定义颜色 rgb值可以使用使用测色计测出数值
tagLabel.backgroundColor =[UIColor colorWithRed:49/255.f green:208/255.f blue:202/255.f alpha:1];
设置字体居中 其他靠左靠右可以直接查看属性
tagLabel.textAlignment = NSTextAlignmentCenter;
设置圆角
tagLabel.layer.cornerRadius = 15;
[tagLabel setClipsToBounds:YES];
当然要把它加入到view中
[self.View addSubview:tagLabel];
Uilabel * tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.width/2-50, 165, 100, 30)];
设置自定义颜色 rgb值可以使用使用测色计测出数值
tagLabel.backgroundColor =[UIColor colorWithRed:49/255.f green:208/255.f blue:202/255.f alpha:1];
设置字体居中 其他靠左靠右可以直接查看属性
tagLabel.textAlignment = NSTextAlignmentCenter;
设置圆角
tagLabel.layer.cornerRadius = 15;
[tagLabel setClipsToBounds:YES];
当然要把它加入到view中
[self.View addSubview:tagLabel];
相关文章推荐
- Error:Execution failed for ..dk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1错误
- TypedValue解析
- java中String、StringBuffer、StringBuilder的区别
- 软件版本GA,RC,alpha,beta,Build 含义
- ActionContext 、ValueStack 、Stack Context
- js 实现动态key value(JSON字符串注意事项:key和value都要用双引号,官网指定用双引号)
- 浅析 c# Queue
- requests抓取需登录(cookie)的页面
- android graphic(19)—why Android's UI was designed the way it is and how it actually works
- LeetCode OJ 334. Increasing Triplet Subsequence
- SonarQube-Java规范之Atomic-".equals()" should not be used to test the values of "Atomic" classes
- android graphic(18)—How about some Android graphics true facts?
- 设计模式 - Builder模式
- 用marquee和div+js实现首尾相连循环滚动效果
- GTK+ and Glade3 GUI Programming
- gtk+2.0和glade3.4.5的GUI编程
- configure: error: ZLIB extension requires zlib >= 1.0.9
- Druid连接池配置
- UGUI点击事件(委托)
- GUID批量生成