1. 取消Cell的高亮选中状态:
Cell是能被选中的,只是没有了选中时(highlight状态)的颜色
cell.selectionStyle = UITableViewCellSelectionStyleNone;
2. 取消Cell的分割线:
Cell分割线的属性设置(颜色separatorColor,长度separatorInset,等)
_myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
3. 使用MJRefresh的时候有时会出现下拉刷新以后tableView回不了顶端的问题:
具体原因不明,不过有个有效方法:即在添加tableView之前先加一个frame={0,0,0,0}的view。
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
[self.view addSubview:view];
//用这个方法来解决刷新界面掉出来的问题
4. 左滑删除当前行
#pragma mark - 编辑:左滑删除
-(NSString*)tableView:(UITableView*)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath*)indexpath{
return @"删除";
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
//删除操作:先删除数据源,再刷新视图
if (editingStyle == UITableViewCellEditingStyleDelete) {
[self.dataArray removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationRight];
}
}
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath{
//开始编辑前
NSLog(@"编辑开始");
}
- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath{
//编辑完成后
NSLog(@"操作完成");
}