Ios 未设置UITableView背景
我在viewDidLoad中有这段代码(将它放在viewDidAppear中也不起作用) 但我看不到任何图像背景。它是完全白色的-就像没有设置图像一样。为什么呢 请注意,我的tableview有自己的控制器-初始化如下:Ios 未设置UITableView背景,ios,uitableview,Ios,Uitableview,我在viewDidLoad中有这段代码(将它放在viewDidAppear中也不起作用) 但我看不到任何图像背景。它是完全白色的-就像没有设置图像一样。为什么呢 请注意,我的tableview有自己的控制器-初始化如下: AppDelegate *del = (AppDelegate*)[[UIApplication sharedApplication] delegate]; PAPHomeViewController *vc = del.homeViewController; vc.view.
AppDelegate *del = (AppDelegate*)[[UIApplication sharedApplication] delegate];
PAPHomeViewController *vc = del.homeViewController;
vc.view.frame = self.containerView.bounds;
[self.containerView addSubview:vc.view];
[self addChildViewController:vc];
所以,就像我看到的是containerView的背景,而不是tableview的背景
试着这样做也无济于事:
[self.containerView setBackgroundColor:[UIColor clearColor]];
即使下拉表格视图以便可以看到第一个单元格上方的图像,您也看不到图像?如果是这样,那么您应该检查[UIImage ImageName:@“BackgroundLeather.png”]是否返回图像。您还应该检查self.tableView是否为零。@rdelmar是的,即使我下拉的结果是白色的,也不是在单元格后面。imageNamed返回null-问题已解决。回答这个问题,我会接受的。
[self.containerView setBackgroundColor:[UIColor clearColor]];