如何在 UIPopoverController 中设置 UITableView 的背景颜色?
我正在使用 iOS SDK 4.2。我有一个使用导航控制器初始化的 UIPopoverController,该导航控制器使用视图控制器初始化。视图控制器的子视图之一是分组表视图。我想更改表格视图的背景颜色。但是,如果我在视图控制器的 viewDidLoad 方法中执行此操作,则
self.myTableView.backgroundColor = [UIColor blackColor];
背景不会更改,当弹出窗口出现时,表视图的背景为灰色。有什么线索吗?这种方法有什么问题吗? 先感谢您。
I am using iOS SDK 4.2. I have an UIPopoverController initialized with a navigation controller which is initialized with a view controller. One of the subviews of the view controller is a grouped table view. I would like to change the background color of the table view. However, if I do in the viewDidLoad method of the view controller
self.myTableView.backgroundColor = [UIColor blackColor];
the background does not changes, when the popover appears, the background of the table view is gray. Any clue? What's wrong with this approach?
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
分组表视图在
backgroundView
属性中有一个自定义视图。该自定义视图显示背景。如果您想更改背景,您应该创建自己的视图并将其分配给那里。就您而言,您可能需要如下所示的内容:Grouped table views have a custom view in the
backgroundView
property. This custom view is what displays the background. If you want to change the background, you should create your own view and assign it there. In your case, you probably want something like the following: