IOS UITableViewCell样式
来源:互联网 发布:周期表中原子半径数据 编辑:程序博客网 时间:2024/06/08 05:45
IOS UI阶段学习 UITableView样式 UITableViewCell样式的图示
首先奉上一个通过plist文件的方式,高效,方便快捷的创建不同样式cell 的方法
当我们需要定义不同类型的cell的时候,如果通过纯代码创建,可能任务量会比较大,而且效率不高,所以我举一个开发中常用到的 方法
1.首先,我们自定义一个Cell 继承自UITableViewCell 在里面封装好那些基础的东西.这些就不说了.....我在这里直接给大家呈上我今天所说的这段重点代码了
这个plist文件中的一个数组 保存的着若干个字典 (每个字典其实是包含若干个同类型的自定义cell ,添加一个键值对,指定一个cell样式的类型)
+ (UITableViewCellStyle)cellStyleWithDict:(NSDictionary *)dict
{
UITableViewCellStyle cellStyle = UITableViewCellStyleDefault;
if ([dict[@"cellStyle"] isEqualToString:@"UITableViewCellStyleSubtitle"]) {
cellStyle = UITableViewCellStyleSubtitle;
} else if ([dict[@"cellStyle"] isEqualToString:@"UITableViewCellStyleValue1"]) {
cellStyle = UITableViewCellStyleValue1;
} else if ([dict[@"cellStyle"] isEqualToString:@"UITableViewCellStyleValue2"]) {
cellStyle = UITableViewCellStyleValue2;
}
return cellStyle;
}
UITableView样式有两种:
1.UITableViewStylePlain:
Plain样式的是方形的,充满你给的view.frame坐标。2.2.UITableViewStyleGrouped:
Grouped样式主要是以圆角形显示。跟iphone自带的通讯录编辑页面类似。
二、系统自己的UITableViewCell样式有四种:
1.UITableViewCellStyleDefa
Default样式:左边一个显示图片的imageView,一个标题textLabel,没有detailTextLabel。
2.UITableViewCellStyleSubt
Subtitle样式:左边一个显示图片的imageView,上边一个主标题textLabel,一个副标题detailTextLabel。主标题字体大且加黑,副标题字体小在主标题下边。
3.UITableViewCellStyleValu
Value1样式:左边一个显示图片的imageView,左边一个主标题textLabel,右边一个副标题detailTextLabel,主标题字体比较黑。
4.UITableViewCellStyleValu
Value2样式:左边一个主标题textLabel字体偏小,挨着右边一个副标题detailTextLabel,字体大且加黑。
样式图示 部分 转至
- IOS UITableViewCell样式
- IOS开发中UITableView和UITableViewCell的几种样式
- iOS开发中UITableView和UITableViewCell的几种样式
- IOS开发中UITableView和UITableViewCell的几种样式
- IOS开发中UITableView和UITableViewCell的几种样式
- IOS开发中UITableView和UITableViewCell的几种样式
- IOS开发中UITableView和UITableViewCell的几种样式
- iOS开发中UITableView和UITableViewCell的几种样式
- iOS开发中UITableView和UITableViewCell的几种样式
- iOS开发中 UITableViewCell的几种样式
- iOS开发中UITableView和UITableViewCell的几种样式
- iOS开发中UITableView和UITableViewCell的几种样式
- iOS- UITableViewCell
- ios uitableviewcell
- UITableViewCell样式设置
- 自定义UITableViewCell的样式
- UITableViewCell的样式
- UITableViewcell 样式的自定义
- [阿里Hao]Android无线开发的几种常用技术
- jQuery.validate.js之二【整理】
- 四子棋
- STM32F1系列 调试硬件I2C应注意的问题
- 十款经典php网店系统
- IOS UITableViewCell样式
- [RQNOJ 216][codevs 1041]Car的旅行路线
- NY448寻找最大数
- 大二下半学期以及未来的展望
- 通过使用DOSBOX运行MASM
- 作业——在线学习Android课程之第一周
- CopyOnWriteArraySet 与CopyOnWriteArraySet 的使用 高并发 读写分离
- 代理模式Proxy深入 动态代理
- 神圣罗马帝国