第一個: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];