iOS tip:让你的footTableView的UILabel居中
来源:互联网 发布:资深java工程师招聘 编辑:程序博客网 时间:2024/06/05 02:26
如果你需要编写一个软件,同时支持portrait&landscape,你会遇到一个问题:当屏幕旋转后,如果才能确保一些可视化的things依然居中呢。下面是一个简单的例子,无论设备是否旋转,UITableView的footer中的UILabel保持居中的方法。
1 //create the uiview container 2 UIView *tfooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, _tableView.frame.size.width, 45)]; 3 tfooterView.autoresizingMask = UIViewAutoresizingFlexibleWidth; 4 //create the uilabel for the text 5 UILabel *label3 = [[UILabel alloc] initWithFrame:CGRectMake(_tableView.frame.size.width/2-120, 0, 240, 35)]; 6 label3.backgroundColor = [UIColor clearColor]; 7 label3.font = [UIFont systemFontOfSize:12]; 8 label3.numberOfLines = 2; 9 label3.lineBreakMode = UILineBreakModeWordWrap;10 label3.textAlignment = UITextAlignmentCenter;11 label3.text = @"Some text you want centered in your tableFooterView.";12 label3.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;13 //add the label to the view14 [tfooterView addSubview:label3];15 //add the view to the uitableview footer16 _tableView.tableFooterView = tfooterView;
- iOS tip:让你的footTableView的UILabel居中
- iOS -让UILabel的文字顶部对齐
- iOS 把你的UILabel多彩起来
- css-如何让你的元素居中?
- iOS UILabel垂直居中
- uilabel 的文字是单行的时候,它会垂直居中,让它不垂直居中的解决办法
- iOS--UILabel的使用方法
- 让你的testareabox 前面的字居中
- 使用jq让你的div居中的好方法。
- iOS的UILabel设置居上对齐,居中对齐,居下对齐
- iOS的UILabel设置居上对齐,居中对齐,居下对齐
- iOS的UILabel设置居上对齐,居中对齐,居下对齐
- iOS的UILabel设置居上对齐,居中对齐,居下对齐
- iOS的UILabel设置居上对齐,居中对齐,居下对齐
- iOS的UILabel设置居上对齐,居中对齐,居下对齐
- iOS的UILabel设置居上对齐,居中对齐,居下对齐
- ios---超链接的UILabel教程
- iOS 设置UILabel的背景图片
- Fedora17下安装OpenCV2.3.1[转]
- Apache MPM两种方式讲解
- Centos 6编译安装apache&PHP&mysql
- WHY VERSION CONTROL IS IMPORTANT FOR SOLO DEVELOPERS
- __weak&__block&__unsafe__unretain
- iOS tip:让你的footTableView的UILabel居中
- 解决UITableView中image加载不同宽度尺寸图片的问题
- [ThirdParty]notnoop / java-apns
- [ThirdParty]Jedis
- word2007打开时总是弹出文件转换窗口【解决办法】
- 用户态和内核态的区别
- 做技术的出路
- Hadoop集群中hosts文件配置问题
- AS3 HTML标签使用