标签:round sel xpath ack style row set sep insets
swift一个大进步,只要设置tableView.separatorInset = UIEdgeInsets.zero即可补全分割线,
而在OC中,我们要实现UITableViewDelegate的两个代理方法才能得到想要的效果。OC实现代码如下
- (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];
}
}
标签:round sel xpath ack style row set sep insets
原文地址:http://www.cnblogs.com/yang-shuai/p/7466605.html