Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
[tableView setBackgroundColor:[UIColor clearColor]]不仅适用于配备iOS8的iPad_Ios_Iphone_Ipad_Uitableview_Uibackgroundcolor - Fatal编程技术网

[tableView setBackgroundColor:[UIColor clearColor]]不仅适用于配备iOS8的iPad

[tableView setBackgroundColor:[UIColor clearColor]]不仅适用于配备iOS8的iPad,ios,iphone,ipad,uitableview,uibackgroundcolor,Ios,Iphone,Ipad,Uitableview,Uibackgroundcolor,声明: [tableView setBackgroundColor:[UIColor clearColor]]; [self.navigationController pushViewController:[TestViewController new] animated:YES]; 仅对iPad没有影响,尤其是在iOS8上,仅对我现有的应用程序有影响。为了进行一次测试,我创建了一个新的测试应用程序,只是为了指出问题所在,但是它可以正常工作。我创建了一个UIViewController类,如

声明:

[tableView setBackgroundColor:[UIColor clearColor]];
[self.navigationController pushViewController:[TestViewController new] animated:YES];
仅对iPad没有影响,尤其是在iOS8上,仅对我现有的应用程序有影响。为了进行一次测试,我创建了一个新的测试应用程序,只是为了指出问题所在,但是
它可以正常工作
。我创建了一个
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:

[tableView setBackgroundColor:[UIColor clearColor]];
[self.navigationController pushViewController:[TestViewController new] animated:YES];
从新的测试应用程序推送结果如下(如我所愿):

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

@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

清除背景色在iOS7 iPhone和iPad下,甚至在iOS8 iPhone上都能完美工作。我试图找到可以影响外观的UIAppearance代理实现,但没有任何效果。

我已经尝试了一些建议,包括将背景视图设置为零,以及它们没有帮助

为什么它与新的测试应用程序一起工作,为什么它与我现有的应用程序不一起工作?是否与
UINavigationController
有关


NB:请不要标记为重复,因为此处的问题与现有问题完全不同或略有不同

这是细胞的颜色。所以你必须改变你细胞的颜色。有关更多信息,请参阅

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

试试上面的代码

我已经试过你的建议,我也试过了,但没有变化。请注意,上述(我的代码)适用于一个应用程序,而不适用于另一个应用程序。谢谢