Objective c iOS在普通tableview中使用背景

Objective c iOS在普通tableview中使用背景,objective-c,ios,cocoa-touch,uitableview,background-image,Objective C,Ios,Cocoa Touch,Uitableview,Background Image,我想知道我是如何在普通的tableview(非分组)中使用背景的。例如,看看时钟应用程序和背景。有什么想法吗?您也可以尝试将自己的图像设置为backgroundView: UIImage *yourImage = ... UIImageView *imageView = [[UIImageView alloc] initWithImage:yourImage]; self.tableView.backgroundView = imageView; [imageView release]; 您可

我想知道我是如何在普通的tableview(非分组)中使用背景的。例如,看看时钟应用程序和背景。有什么想法吗?

您也可以尝试将自己的图像设置为
backgroundView

UIImage *yourImage = ...
UIImageView *imageView = [[UIImageView alloc] initWithImage:yourImage];
self.tableView.backgroundView = imageView;
[imageView release];

您可以使用与分组表视图相同的技术设置表视图的背景(类似于
self.tableView.backgroundView=anImageView;
),但单元格的背景不透明,因此会将其隐藏

然后,您必须在tableView:cellForRowAtIndexPath:中将单元格的背景色设置为clearColor
[UIColor clearColor]
,并将其backgroundView设置为零

现在运行应用程序,可能仍然有问题:单元格标签的背景可能也是不透明的(我说可能是因为单元格可能选择了单元格背景颜色,并相应地更改了其子视图的背景颜色)。 如果是这种情况,请再次在tableView:cellForRowAtIndexPath:中,将子视图的背景色设置为clearColor