ipad - iPad应用程序中的TableView背景图片

标签 ipad uitableview

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

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

谢谢

最佳答案

这是魔法:

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

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

关于ipad - iPad应用程序中的TableView背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5186640/

相关文章:

iphone - 使用单个 NSMutableArray 填充 UITableView 部分表

ios - ipad模拟器上的UIImagePicker不是全宽

ios - Swift:将重新排列按钮移至左上角

iOS:当键盘出现时禁用 UITableView 动画

ipad - 为 iPad 提供 mp4 视频

iphone - 从通用应用程序中排除 iPhone 3GS 和旧款 iPhone 和 iPod

ipad - 行比 UITableView 本身更窄

ios - 当 UICollectionView 位于 iOS 中的自定义 TableViewCell 内时,如何实现 UICollectionView 的委托(delegate)和数据源方法, Objective-C

ios - TableViewCell 问题上的 MapView

iphone - 模型版本控制和数据迁移之间有什么区别?