【发布时间】:2009-10-28 23:39:17
【问题描述】:
我正在使用下面的方式来设置 UITableView 的背景。
self.tableView.backgroundColor = [UIColor clearColor];
self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithData:imageData]];
我想设置为背景的图像是浅灰色但是我看到的图像是全白的。
有什么问题。就像 colorWithPatterImage 或 UITable 一样。
【问题讨论】:
-
访问 parentViewController.view 是一个糟糕的想法——你不知道它有什么样的支持,这是对封装的严重违反。即使它现在可以工作,下一次 iOS 更新也可能完全破坏你的代码。不要这样做。
标签: iphone