iOS开发之UIlabel多行文字自动换行 (自动折行)
2015-10-16 16:27
736 查看
UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(10, 100, 300, 180)];
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 300, 150)];
label.text = @"Hello world! Hello world!Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!Hello world!
Hello world! Hello world! Hello world! Hello world! Helloworld!";
//背景颜色为红色
label.backgroundColor = [UIColor redColor];
//设置字体颜色为白色
label.textColor = [UIColor whiteColor];
//文字居中显示
label.textAlignment = UITextAlignmentCenter;
//自动折行设置
label.lineBreakMode = UILineBreakModeWordWrap;
label.numberOfLines = 0;
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 300, 150)];
label.text = @"Hello world! Hello world!Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!Hello world!
Hello world! Hello world! Hello world! Hello world! Helloworld!";
//背景颜色为红色
label.backgroundColor = [UIColor redColor];
//设置字体颜色为白色
label.textColor = [UIColor whiteColor];
//文字居中显示
label.textAlignment = UITextAlignmentCenter;
//自动折行设置
label.lineBreakMode = UILineBreakModeWordWrap;
label.numberOfLines = 0;
相关文章推荐
- UIView hitTest:withEvent:方法流程
- iOS 中UUID唯一标记的使用
- ios UIView animateWithDuration 学习
- AndroidUI--SimpleAdapter CursorAdapter
- Leetcode:unique_binary_search_trees
- 记录使用Buildbot遇到的坑
- Mechanize Guide
- Retrofit(2.0)入门小错误 -- Could not locate ResponseBody xxx Tried: * retrofit.BuiltInConverters
- java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
- FDStackView —— Downward Compatible UIStackView (Part 1)
- 【UIAlertView警报和UIActionSheet操作表】
- Android UI组件的动态更新
- EasyUI加载内嵌json数据方法
- Handler post()等在子线程中更新主线程的UI的方法使用小汇
- Do odex for prebuilt apk in kitkat
- druid连接池配置
- UIStackView如何让你的开发更简单
- IOS8以上版本,使用UIAlertController代替 UIActionSheet和UIAlertView
- iOS开发UI篇—Quartz2D使用(绘制基本图形)
- JAVA学习3_Java多线程-工具篇-BlockingQueue