gpt4 book ai didi

ios - [tableView setBackgroundColor :[UIColor clearColor]] is not working only on iPad with iOS8

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

声明:

[tableView setBackgroundColor:[UIColor clearColor]];

仅在 iPad 上没有效果,尤其是在 iOS8 和我现有的 App 上。只是为了测试一下,我创建了一个新的测试应用程序来查明问题,但它有效。我创建了一个 UIViewController 类,如下所示:

@implementation TestViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.

[self.view setBackgroundColor:[UIColor purpleColor]];

UITableView *aTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 100, 300, 300) style:UITableViewStylePlain];

[aTableView setBackgroundColor:[UIColor clearColor]];

[self.view addSubview:aTableView];
}

@end

并使用以下语句推送 ist:

[self.navigationController pushViewController:[TestViewController new] animated:YES];

像这样从新的测试应用程序中推送结果(如我所愿):

enter image description here

但是从我现有的应用程序(我必须实现的真实应用程序)结果如下:

enter image description here

即使在 iOS 8 iPhone 上,清除背景颜色在 iOS7 iPhone 和 iPad 下也能完美运行。我试图找到可以影响外观的 UIAppearance 代理实现,但没有。

我已经尝试了一些SO 提案,包括将backgroundView 设置为nil,但它们没有帮助

为什么它可以与新的测试应用程序一起使用,为什么它不能与我的现有应用程序一起使用?与 UINavigationController 有任何关系吗?

注意:请不要标记为重复,因为这里的问题与现有问题完全或略有不同。

最佳答案

这是单元格的颜色。所以你必须改变你的细胞的颜色。有关详细信息,请参阅

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

关于ios - [tableView setBackgroundColor :[UIColor clearColor]] is not working only on iPad with iOS8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26602714/

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