相关疑难解决方法(0)

在UITableViewController代码中添加UITable后面的UIView

我想在我的iPhone程序的简单分组表视图中使用固定图像作为背景.不幸的是,无论我做什么,背景总是纯白色.我已经在这个网站上跟随了几个假设的解决方案而其他方面都无济于事.这是表视图控制器类的viewDidLoad方法中的相关代码(注意,为简单起见,此代码使用纯蓝色而不是图像):

self.tableView.opaque = NO;
self.tableView.backgroundColor = [UIColor clearColor];
UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
backgroundView.backgroundColor = [UIColor blueColor];
[self.tableView.window addSubview:backgroundView];
[backgroundView release];
Run Code Online (Sandbox Code Playgroud)

我怀疑我没有将backgroundView视图放在正确的位置.我尝试过sendToBack :,来自ToFront:和其他人,但我总是得到一个白色背景.是否可以在UITableViewController中执行此操作?我必须使用Interface Builder吗?

iphone cocoa-touch background uitableview

15
推荐指数
2
解决办法
1万
查看次数

标签 统计

background ×1

cocoa-touch ×1

iphone ×1

uitableview ×1