gpt4 book ai didi

ios - UITableView 中单元格顶部的 UIView

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:20:39 24 4
gpt4 key购买 nike

我有一个单元格,我想在上面放置这样的 View :

 ------------------------------------------------

Cell 1
----------
| |
----------------- View -------------------
| |
----------

Cell 2
------------------------------------------------

但是当我将它添加到单元格 1 时,它最终会变成这样,因为单元格 2 隐藏了一半:

 ------------------------------------------------

Cell 1
----------
| View |
------------------------------------------------



Cell 2
------------------------------------------------

最佳答案

首先,检查 clipsToBounds 属性:

cell.clipsToBounds = NO;

其次,您需要让另一个单元格具有在最后可能时刻绘制的透明背景:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell 
forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor clearColor];
}

如果这不起作用,请尝试单元格的 contentView

关于ios - UITableView 中单元格顶部的 UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18674786/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com