码迷,mamicode.com
首页 > 移动开发 > 详细

(转) IOS8 设置TableView Separatorinset 分割线从边框顶端开始

时间:2015-04-01 19:08:47      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:

在ios8上 [TableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];不起作用

经过测试加入下面方法 在ios7 8上都可以正常工作

 

 1 -(void)viewDidLayoutSubviews
 2 {
 3     if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
 4         [self.tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
 5     }
 6     
 7     if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
 8         [self.tableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];
 9     }
10 }
11 
12 -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
13 {
14     if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
15         [cell setSeparatorInset:UIEdgeInsetsZero];
16     }
17     
18     if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
19         [cell setLayoutMargins:UIEdgeInsetsZero];
20     }
21 }

 

(转) IOS8 设置TableView Separatorinset 分割线从边框顶端开始

标签:

原文地址:http://www.cnblogs.com/lishaoyou/p/4384634.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!