IOS 8 UITableView cell lines不能靠左解决方法
时间:2014-10-22 17:20:40
收藏:0
阅读:454
ios7中用以下方法可使UITableView cell lines靠左
self.tableview.separatorInset = UIEdgeInsetsZero;
但在ios8中该办法已失灵啦
经过翻阅ios8文档发现用以下两种办法即可解决该问题
方法一:
- (void) viewDidLoad {
[...]
self.tableView.separatorInset = UIEdgeInsetsZero;
if ([self.tableView respondsToSelector:@selector(layoutMargins)]) {
self.tableView.layoutMargins = UIEdgeInsetsZero;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
[...]
cell.separatorInset = UIEdgeInsetsZero;
if ([cell respondsToSelector:@selector(layoutMargins)]) {
cell.layoutMargins = UIEdgeInsetsZero;
}
}
方法二:
- (UIEdgeInsets)layoutMargins
{
return UIEdgeInsetsZero;
}
原文:http://www.cnblogs.com/zhaoguowen/p/4043724.html
评论(0)