首页 > 学院 > 开发设计 > 正文

TableView Separatorinset 分割线从边框顶端开始

2019-11-07 23:25:17
字体:
来源:转载
供稿:网友
IOS8 设置TableView Separatorinset 分割线从边框顶端开始   在ios8上 [TableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];不起作用 经过测试加入下面方法 在ios7 8上都可以正常工作-(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];    }}
上一篇:常用正则表达式

下一篇:遍历字典

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表