您的位置:首页 > 移动开发 > IOS开发

ios8 ios7 tableview cell 分割线左对齐

2015-01-10 09:05 393 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: