iOS中cell的邊框處理
http://blog.csdn.net/rhljiayou/article/details/10178723
1,如何讓cell 能夠響應(yīng) select睬澡,但是選中后的顏色又不發(fā)生改變呢,那么就設(shè)置
cell.selectionStyle = UITableViewCellSelectionStyleNone;
2,如何設(shè)置tableview 每行之間的 分割線
self.tableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
如果不需要分割線点楼,那么就設(shè)置屬性為 UITableViewCellSeparatorStyleNone 即可辐董。
3,如何設(shè)置 tableview cell的背景顏色
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//設(shè)置背景顏色
cell.contentView.backgroundColor=[UIColor colorWithRed:0.957 green:0.957 blue:0.957 alpha:1];
}
4, 箭頭響應(yīng)
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
這個(gè)函數(shù)響應(yīng)悴品,用戶點(diǎn)擊cell 右邊的 箭頭(如果有的話)
5,如何設(shè)置tableview 可以被編輯,首先要進(jìn)入編輯模式:
[TableView setEditing:YES animated:YES];
如果要退出編輯模式,肯定就是設(shè)置為NO
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
返回當(dāng)前cell 要執(zhí)行的是哪種編輯简烘,下面的代碼是 返回 刪除 模式
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}
-(void) tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle) editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
通知告訴用戶編輯了 哪個(gè)cell他匪,對(duì)應(yīng)上面的代碼,我們?cè)谶@個(gè)函數(shù)里面執(zhí)行刪除cell的操作夸研。
[cpp] view plain copy
-(void) tableView:(UITableView *)aTableView
commitEditingStyle:(UITableViewCellEditingStyle) editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath
{
[chatArray removeObjectAtIndex:indexPath.row];
[chatTableView reloadData];
}
組頭部尾部懸停
http://www.open-open.com/lib/view/open1451831639823.html