关于tableview cell之间的分割线的问题

iOS 码拜 9年前 (2015-10-01) 798次浏览

关于tableview cell之间的分割线的问题

就像iphone 中的设置那样,如何实现分割线只有一部分呢?(即:图标下方没有分割线,文字下方才有分割线)

方案推荐指数:10

 谢邀,这个鄙人刚试了下 是可以实现的。首先 tableView的cell不要注册   在下边写
static NSString *iden = @”Cell”;
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:iden];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:iden];
    }
cell.textLabel.text = @”123″;
cell.detailTextLabel.text = @”456″;
    [cell.imageView sd_setImageWithURL:[NSURL URLWithString:model.headurl] placeholderImage:[UIImage imageNamed:@”place_webImg”]];
    cell.imageView.layer.cornerRadius = cell的高/2;
    cell.imageView.layer.masksToBounds = YES;
return cell;
cell的style 设为  subtitle(UITableViewCellStyleSubtitle)  你试下看 有什么问题再讨论

方案推荐指数:10
//设置分割线的风格
tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    
//设置分割线距边界的距离
tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明关于tableview cell之间的分割线的问题
喜欢 (0)
[1034331897@qq.com]
分享 (0)