【问题标题】:TableView background Image in iPad ApplicationiPad应用程序中的TableView背景图像
【发布时间】:2011-03-03 21:14:42
【问题描述】:

我有以下代码在 iPhone 应用程序中运行良好,但在 iPad 中我总是得到灰色/浅蓝色背景颜色。即使我更改了背景颜色,它也不会生效。

[self.tableView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg1024x768.png"]]];

谢谢

【问题讨论】:

    标签: ipad uitableview


    【解决方案1】:

    这就是魔法:

    if ( [self.myTableView respondsToSelector:@selector(backgroundView)] )
        self.myTableView.backgroundView = nil;
    self.myTableView.backgroundColor = [UIColor clearColor];
    

    另外,将 UIViewController 与 UITableView 一起使用,而不是 UITableViewController,并将背景图像放在 UITableView 下的 UIImageView 中。

    【讨论】:

    • 感谢 Bogatyr。我要试一试。会让你知道的。
    • 附注我遇到了完全相同的问题,这令人愤怒。问题是在 OS3.2(ipad 的第一个版本)中添加了 backgroundView 属性。
    • 嗨 Bogatyr,我已经尝试过了,现在我得到了白色背景。在我的 nib 文件中,我有 UIView。在此之下,我有 imageview(背景图像)和 tableview。图像放置在 tableview 下。有什么想法吗?
    • 你把tableview的背景色设置为clearcolor了吗?你是在正确的地方做的吗(viewDidLoad 是个好地方)?
    • 是的,我把它放在 ViewDidLoad 中。我一点头绪都没有。有什么想法吗?
    猜你喜欢
    • 1970-01-01
    • 2011-06-22
    • 1970-01-01
    • 2012-07-14
    • 1970-01-01
    • 1970-01-01
    • 2014-08-29
    • 2012-12-25
    • 1970-01-01
    相关资源
    最近更新 更多