UITableView背景,边框线设置
来源:互联网 发布:一城一名店网络平台 编辑:程序博客网 时间:2024/05/22 15:57
UITableViewStylePlain类型的UITableView去除边框线有直接的属性方法:
tableview.separatorStyle =
在UITableViewStyleGrouped类型的UITableView中
separatorColor=[UIColor clearColor];
1.去掉分隔线,背景:
2.设置边粗细及颜色:
self.layer.borderWidth=4.0;
self.layer.borderColor=[[UIColor redColor]CGColor];
3.基本使用方法
http://blog.csdn.net/tangaowen/archive/2011/05/22/6438362.aspx
UITableView每一行的高度默认是44,
4.在UITableView.h头文件中,对NSIndexPath增加了类别,增加了section,row方法,分别获取选择的列索引,行索引。
+ (NSIndexPath *)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section;
@property(nonatomic,readonly) NSUInteger section;
@property(nonatomic,readonly) NSUInteger row;
@end
5. 给UITableViewCell的成员设置框架属性后不起作用,解决办法是在UITableViewCell的子类中重写layoutSubviews,在其中改变一些属性的值,例如下:
- (void)layoutSubviews {
}
http://stackoverflow.com/questions/3130804/changing-bounds-of-imageview-of-uitableviewcell
6.UITableViewCell.selectionStyle设置选定时的单元格颜色。
7.重用单元格:测试发现在cellForRowAtIndexPath中,会alloc屏幕所显示的数量+1个UITableViewCell,并且显示每个单元格都会进入UITableViewCell函数调用。
8.设置UITableViewCell的背景色将看不到效果。
9.四种UITableViewCellStyle
还可以自定义设置accessoryView,替换accessoryType的内置效果。
例如显示系统的加号图标按钮:cell.accessoryView=[UIButton buttonWithType:UIButtonTypeContactAdd];
10.可以继承UITableViewCell来创建自定义的cell。
11.主动移除单元格选中状态:
12.删除单元格:设置[tableview setEditing:YES];表格为编辑状态。
13.移动表格:
14.表格排序是对数模型源排序,然后reloadData。
15.《秘籍2》11.17中介绍了搜索表格。
16.索引功能,分组样式
17.UIPickerView:
18. heightForRowAtIndexPath先于cellForRowAtIndexPath执行。
19.UITableViewDataSource
//设置某行是否可编辑,如果有的行可编辑,有的不可编辑,会出现只有部分行向右移动的情况。但不影响功能。
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
}
//设置让UITableView行缩进
-(NSInteger)tableView:(UITableView *)tableViewindentationLeve
}
//返回当前所选cell
NSIndexPath *ip = [NSIndexPath indexPathForRow:row inSection:section];
[TopicsTable selectRowAtIndexPath:ip animated:YESscrollPosition:UITableViewScrollPositio
//设置UITableView的style
[tableView setSeparatorStyle:UITableViewCellSelection
//设置选中Cell的响应事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath{
}
//设置选中的行所执行的动作
-(NSIndexPath *)tableView:(UITableView *)tableViewwillSelectRowAt
{
}
//设置划动cell是否出现del按钮,可供删除数据里进行处理
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath*)indexPath {
}
//设置删除时编辑状态
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingSt
forRowAtIndexPath:(NSIndexPath *)indexPath
{
}
//右侧添加一个索引表
- (NSArray *)sectionIndexTitlesForTab
}
(2)
//选中cell时的颜色,在官方文档有如下可以选择
typedef enum {
} UITableViewCellSelection
//cell右边按钮格式
typedef enum {
} UITableViewCellAccessory
//是否加换行线
typedef enum {
} UITableViewCellSeparator
//改变换行线颜色
tableView.separatorColor= [UIColor blueColor];
4.
表中的每一行都代表一个UITableViewCell。可以使用图像、文本还有辅助的图标等来自定义你自己的UITableViewCell。你可以自定义你自己的cell如下模型或者像appstore那样的。
UITableViewCell为每个Cell提供了三个可以选择的属性,如下:
l textLabel:填写文本
l detailTextLable:稍微详细的副标题
l imageView:用来显示你cell的图片,可以通过UIImage来加载。
- UITableView背景,边框线设置
- 去除UITableView的边框线,背景,边框线设置
- UISearchBar 背景 边框设置
- Android 设置背景边框
- UITableView设置背景透明
- UITableView背景颜色设置
- UITableView背景颜色设置
- 设置 UITableView 边框 cell 边框 竖线
- 边框和background-背景设置
- storyboard 设置view边框背景
- CSS:设置边框和背景
- css边框和背景设置
- UITableView设置背景为透明
- UITableView设置背景为透明
- IOS开发之----设置UITableView边框(
- ios开发-设置UITableView/Cell背景设置
- UITableViewCell - UITableView中cell的边框和背景
- UITableViewCell - UITableView中cell的边框和背景 .
- Linq to sql:事务处理
- Html5 学习系列(二)HTML5新增结构标签
- cocos2d-x的版本更换和cocos2d-x2.1.4的安装
- javascript tab切换
- 【找规律】HDU 4662——MU Puzzle
- UITableView背景,边框线设置
- XLSTransformer生成excel文件
- 忽然之间
- Android 中 Service 全面解析与使用
- B树、B-树、B+树、B*树
- Android组件间通信机制对面向对象特性的影响
- go语言有关结构体的问题
- ROW_NUMBER() OVER函数的基本用法
- 小本IT的成功故事