gpt4 book ai didi

iphone - 使用静态单元格删除 UITableView 部分边框和背景颜色?

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

我正在使用带有静态单元格的 UITableView 来制作一个小表格。

我在 UITableView 中添加了多个部分,但现在我必须删除显示登录忘记密码的部分的背景颜色和边框 按钮。

查看下面的屏幕截图。

enter image description here

问题1

如何去除背景颜色和边框?

问题2

无论如何也可以更改 View 的背景颜色。此 View 继承自 UITableViewController。我认为我需要更改部分或组的颜色。

我将标识符分配给单元格并移除背景色。

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{

if([cell.reuseIdentifier isEqualToString:@"ButtonsCell"])
{
cell.backgroundColor = [UIColor clearColor];



NSLog(@"login buttons cells found");
}


}

这是图片:

enter image description here

但边界仍然显示!


解决方案

奇怪但有效!

cell.backgroundView = nil; 

最佳答案

我想你想根据你在 cellForRowAtIndexPath 中的部分做一个开关盒。然后用透明 View 替换该行的背景。

switch (section)
{
case BACKGROUND_SECTION:
{
// Only way I could find to get row centered
segmentCell.selectionStyle = UITableViewCellSelectionStyleNone;
[segmentCell setAccessoryType:UITableViewCellAccessoryNone];
// Make the cell background transparent
UIView *backView = [[UIView alloc] initWithFrame:CGRectZero];
backView.backgroundColor = [UIColor clearColor];
segmentCell.backgroundView = backView;
}
}

关于iphone - 使用静态单元格删除 UITableView 部分边框和背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14025645/

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