Tag: 重叠

UITableView中的单元格重叠。 许多细胞在一个地方

我试图用随机数字的标签进行表视图。一切工作,直到我试着滚动它。 比许多细胞出现在一个地方。 它看起来像这样: 从模拟屏幕 为了使viewDidLoad()中的随机行高度我把这个: tableView.estimatedRowHeight = 50.0 tableView.rowHeight = UITableViewAutomaticDimension 用随机数行写随机数的标签的代码在这里: override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "HarvestPlan", for: indexPath) as! HarvestPlanCell let currentSpecies = harvestPlan[indexPath.row] var kindLabels = [UILabel]() cell.kindsNamesView.bounds.size.width = 100 for kind in currentSpecies.kinds { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false […]

多个UIView的重叠

我在自定义UIView's创build多个自定义UIView 。 自定义子视图的创build是可以的。 他们看起来像这样: 绘制方法非常简单: [[UIColor brownColor] set]; CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(ctx, 5.0f); CGContextBeginPath(ctx); CGContextMoveToPoint(ctx, 0.0f, 0.0f); CGContextAddLineToPoint(ctx, 100.0f, 0.0); CGContextAddLineToPoint(ctx, 130.0f, 25.0f); CGContextAddLineToPoint(ctx, 100.0f, 50.0f); CGContextAddLineToPoint(ctx, 0.0f, 50.0f); CGContextClosePath(ctx); CGContextStrokePath(ctx); [super drawRect:rect]; 将它添加到超级视图也很简单: ITContextFigure *view = [[ITContextFigure alloc] initWithFrame:CGRectMake(location.x, location.y, 135.0f, 50.0f)]; [view setBackgroundColor:[UIColor yellowColor]]; [self addSubview:view]; 所以我的问题是: 1)如何检测一个与另一个重叠? 我看到这个解决scheme: if (CGRectContainsRect([myImageView1 frame], […]

如何重叠UITableViewCells?

如果你看截图,你会注意到每个UITableViewCell从顶部到上部的tableview单元重叠20%。 有什么办法可以重叠单元格吗?