標籤:ati 使用 開始 底部 elf index splay sep class
第一種(不自己畫線):
代碼如下
// tableView的分割線從零開始-(void)viewDidLayoutSubviews{ if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { [self.tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)]; } if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) { [self.tableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)]; }}-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; }}
第二種
自訂Cell 在Cell中自己畫線
要使用這種方法 把tableView的內建分割線先去掉
self.table.separatorStyle = UITableViewCellSeparatorStyleNone;
然後在自訂cell裡面
寫一個view在最底部 當作分割線 就好了。
iOS UITableView 分割線從零開始