首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >细胞分离重叠重叠细胞iOS

细胞分离重叠重叠细胞iOS
EN

Stack Overflow用户
提问于 2014-08-18 02:20:14
回答 1查看 408关注 0票数 0

我在一个iPhone应用程序中有一个表视图。我有两个动态定制的单元格,它们之间有一个单元格分隔器。故事板只显示单元格,但分隔符是在应用程序中编码的。分离器正在超调第二单元格并覆盖部分顶部,包括一些文本。我能做些什么来弥补这种重叠呢?

代码语言:javascript
复制
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *c=nil;
    if (indexPath.row==0) {
        static NSString *CellIdentifier = @"AreaCell";
        LSAreaCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
        APLArea *area=[self getAreaForIndexPath:indexPath];
        cell.areaImageView.image=[UIImage imageNamed:area.imageName1];
        c=cell;
    }
    else
    {
        static NSString *QuoteCellIdentifier = @"QuoteCellIdentifier";

        APLQuoteCell *cell = (APLQuoteCell*)[tableView dequeueReusableCellWithIdentifier:QuoteCellIdentifier];
        cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"binding_light"]];

        cell.subarea = [self getSubareaForIndexPath:indexPath];
        c=cell;

        //I put in a seperator on aug 14.  it was supposed to be released!!!
        UIView *cellSeparator = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320 ,35)];
        [cellSeparator setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin |
         UIViewAutoresizingFlexibleRightMargin |
         UIViewAutoresizingFlexibleWidth];
        [cellSeparator setContentMode:UIViewContentModeTopLeft];
        [cellSeparator setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"spacer"]]];
        [cell addSubview:cellSeparator];

       // self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"binding_light"]];
    }
    return c;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-18 05:57:17

我假设您希望这个自定义分隔符完全位于两个单元格之间?

如果是这样,那么您基本上需要首先设置tableview分隔符样式,如下所示

代码语言:javascript
复制
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

然后,您必须在表视图单元格中包含足够的空间,以容纳separator.You可以增加每个单元格的高度,或者使分隔符更小以修复重叠。这些更改将发生在分隔符上的initWithFrame或表视图的cellWithHeight中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25355546

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档