- -
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - {
-
if (indexPath.section == 1) -
{ -
return; -
} -
else if(indexPath.section==0) -
{ -
switch (indexPath.row) -
{ -
//聊天 -
case 0: -
{ -
[self onTalkToFriendBtn]; -
} -
break; -
-
default: -
break; -
} -
} -
else -
{ -
return ; -
} -
- }
- -
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - {
-
//cell被选中后的颜色不变 -
cell.selectionStyle = UITableViewCellSelection StyleNone; - }
- -
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - {
-
//设置背景颜色 -
cell.contentView.backgroundColor=[UIColor colorWithRed:0.957 green:0.957 blue:0.957 alpha:1]; - }
(12)如何设置tableview可以被编辑
首先要进入编辑模式:
- (UITableViewCellEditingSt yle)tableView:(UITableView *)tableVieweditingStyleForRowAtInde xPath:(NSIndexPath *)indexPath
返回当前cell 要执行的是哪种编辑,下面的代码是 返回 删除 模式
-(void)tableView:(UITableView *)aTableView
(13)如何获得某一行的CELL对象
- -
(UITableViewCellEditingSt yle)tableView:(UITableView *)tableView editingStyleForRowAtInde xPath:(NSIndexPath *)indexPath - {
-
return UITableViewCellEditingSt yleDelete; - }
commitEditingStyle:(UITableViewCellEditingSt
forRowAtIndexPath:(NSIndexPath
- -(void)
tableView:(UITableView *)aTableView - commitEditingStyle:(UITableViewCellEditingSt
yle) editingStyle - forRowAtIndexPath:(NSIndexPath
*)indexPath - {
-
[chatArray removeObjectAtIndex:indexPath.row]; -
[chatTableView reloadData]; - }