首页 > 移动平台 > 详细

ios8 ios7 tableview cell 分割线左对齐

时间:2015-01-10 09:59:47      阅读:521      评论:0      收藏:0      [点我收藏+]

ios8中左对齐代码

//加入如下代码
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
     
    if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [tableView setSeparatorInset:UIEdgeInsetsZero];
    }
     
    if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
        [tableView setLayoutMargins:UIEdgeInsetsZero];
    }
     
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}

ios7中左对齐代码

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
self.tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
}

如果在ios7中使用nib或者storyboard可通过下图把Separator Insets的模式改为Custom,并且把Left的15改为0 转载请注明:天狐博客 » iOS7 tableview separatorInset cell分割线左对齐

技术分享

以上内容分别引用 http://blog.sina.com.cn/s/blog_5da93c8f0101qgdz.html http://roybaby.blog.51cto.com/1508945/1558182

ios8 ios7 tableview cell 分割线左对齐

原文:http://www.cnblogs.com/programmer-blog/p/4214489.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!