UITableView: textLabel,detailTextLabel
来源:互联网 发布:防伪底纹设计软件 编辑:程序博客网 时间:2024/05/05 12:23
以前在使用UITableView的时候, 总是在cell上自己加label, 遇到cell的accessoryType不同的时候, 需要自己调整label的大小和位置. 后来发现UITableViewCell中有textLabel和detailTextLabel可以使用, 系统配置好了大小位置, 可以根据cell的不同type和大小自动调整.
textLabel就是放置在cell左边的Label, detailTextLabel就是放置在cell右边的Label, 使用的时候需要把cell的style设为UITableViewCellStyleValue1.
代码如下:
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1reuseIdentifier:@"cell"] autorelease];
[cell.textLabel setText:@"选项"];
[cell.detailTextLabel setTextColor:[UIColor colorWithWhite:0.52 alpha:1.0]];
[cell.detailTextLabel setText:@"详细内容"];
同时UITableViewCell中还有imageView等可以直接使用, 需要进一步研究使用.
0 0
- UITableView: textLabel,detailTextLabel
- UITableView中textLabel和detailTextLabel的使用
- UITableView中textLabel和detailTextLabel的使用
- UITableView中textLabel和detailTextLabel的使用
- cell.textLabel不为空, cell.detailTextLabel=nil.
- iOS设置tableViewCell的cell、textLabel和detailTextLabel背景颜色
- uitableview cell 中的textlabel自动换行问题
- UITableView下拉时textLabel字体消失
- 设置xcode中模版tableViewCell的textLabel和detailTextLabel背景颜色
- 为什么detailTextLabel 不起作用
- iOS如何显示 UITableViewCell detailTextLabel?
- iOS UITableViewCell无法显示detailTextLabel
- UIButton设置textlabel和image位置
- IOS8 UITableViewCell.detailTextLabel不显示解决方法
- ios8 tableview detailtextlabel不显示内容 备注
- UITableView
- UITableView
- UITableView
- [IOS]沙盒(sandbox)机制及获取沙盒路径
- Linux on the i.MX6 sabre sd platform in a few commands
- LCD 驱动
- WinForm 怎样关闭登陆窗体
- 用开源组件jcaptcha做jsp彩色验证码
- UITableView: textLabel,detailTextLabel
- SQL Server bcp 及 NullIf 的使用
- 模板类声明和定义为何要写一起
- 内存分析工具 MAT 的使用
- 删除老的 provisioning profile 如何删除xcode中的多余证书
- JavaScript String 对象
- android大扫盲之SurfaceView,SurfaceHolder,SurfaceHolder.CallBack.
- 【bdump】bdump目录下产生大量cdmp_2014xxx和死锁信息
- android release export has encountered a problem