第一个:cell中的分割线不顶头 代理
首先在viewDidLoad方法加入如下代码: 事件
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { it
[self.tableView setSeparatorInset:UIEdgeInsetsZero]; io
} table
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) { select
[self.tableView setLayoutMargins:UIEdgeInsetsZero]; sso
} scroll
而后在UITableView的代理方法中加入如下代码 方法
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:im
(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
第二:cell中拥有下一个图标
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
第三:点击cell不变颜色 cell.selectionStyle = UITableViewCellSelectionStyleNone;
第四:点击cell后松开按钮 颜色变回原来的样子 在代理点击事件中[tableView deselectRowAtIndexPath:indexPath animated:YES];
第五:去除cell中的分割线 tableView.separatorStyle = UITableViewCellSelectionStyleNone;
第六:隐藏滚动条
scrollView.showsVerticalScrollIndicator = FALSE;
scrollView.showsHorizontalScrollIndicator = FALSE;
第七:把cell中多余的分割线去除 在初始化时加入代码self.tableView.tableFooterView=[[UIView alloc]init];
第八:上拉刷新的时候 cell显示为最上行 [_tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];