本文转自:http://my.oschina.net/zhuzhu1223/blog/474529?fromerr=VQUNYpha 感谢原创作者
欢迎大家学习探讨
1. 解决UITableView分割线距左边有距离的问题
我们在使用tableview时会发现分割线的左边会短一些,通常可以使用setSeparatorInset:UIEdgeInsetsZero 来解决。但是升级到XCode6之后,在iOS8里发现没有效果。下面给出解决办法:
viewDidLoad方法和willDisplayCell中加上如下代码:
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)])
{
[cell setPreservesSuperviewLayoutMargins:NO];
}
本文介绍了解决在iOS8系统下UITableView分割线显示不全的问题。通过设置separatorInset和layoutMargins为UIEdgeInsetsZero,并调整cell的preservesSuperviewLayoutMargins属性,可在XCode6及iOS8中实现完整显示。
2747

被折叠的 条评论
为什么被折叠?



