2.UILabel(文本视图)知识总结
2015-11-14 10:19
435 查看
显示文本的视图UILabel
UILabel继承于UIView 可以使用UIView里的方法初始化
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100 , 100, 100, 200)];
设置属性 添加背景颜色
label.backgroundColor = [UIColor yellowColor];
1.添加字
label.text = @”Application windows are expected to have a root view “;
2.多行显示 完全显示 0 或 -1
label.numberOfLines = 0;
3.设置断行模式
label.lineBreakMode = NSLineBreakByTruncatingMiddle;
4.设置字体颜色
label.textColor = [UIColor blackColor];
5.设置字体对齐方式 右对齐
label.textAlignment = NSTextAlignmentRight;
6.获取系统的所有安装的字体
NSArray *fountArray = [UIFont familyNames];
NSLog(@”%@”,fountArray);
7.设置字体大小
label.font = [UIFont systemFontOfSize:15];
8.设置字体大小及字体类型
label.font = [UIFont fontWithName:@”Kohinoor Devanagari” size:40];
9.设置阴影颜色
label.shadowColor = [UIColor redColor];
10.调整阴影位置
label.shadowOffset = CGSizeMake(2, 1);
[self.window addSubview:label];
[label release];
相关文章推荐
- LeetCode "Range Sum Query 2D - Immutable"
- 我的iOS学习历程 - UITouch(触摸反应)
- 我的iOS学习历程 - UITouch(触摸反应)
- robot-framework 源码阅读 之 suite name 搜索匹配
- 黑马程序员_JavaSE基础知识总结十七:GUI界面
- GPUImage API文档之GPUImageFramebuffer类
- VirtualBox导入虚拟硬盘时uuid已存在问题
- Leetcode Unique Binary Search Trees
- 1.UIView知识总结
- Android高级之Volley框架(三):ImageRequest、ImageLoader、NewworkImageView的使用
- iOS 16进制颜色字符串转换成可以正常使用的UIColor
- IOS 给UIView 设置背景图片
- CF--B - Queries on a String
- iOS9 UICollectionView新推出的Item排序方法
- iOS中 UITabBarController中自定义UITabBar
- iOS中 UITabBarController中自定义UITabBar
- Educational Codeforces Round 1 B. Queries on a String
- Definition Questions
- Leetcode Range Sum Query 2D - Immutable
- Leetcode Range Sum Query - Immutable