我正在使用swift通用应用程序。基础是一个SplitViewController。 tableview嵌入在SplitViewController的详细视图中。 UITableViewCells的背景颜色看起来与预期不同 - 但仅限于iPad。我尝试了以下设置:UITableViewCell在运行时看起来不同于InterfaceBuilder(在iPad上)
层次的看法:
设置:
细胞设置内容视图:
这里是我的代码为 “的cellForRowAtIndexPath”:
let tableData = ["Test User 1", Test User 2"]
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell") as! UITableViewCell!
cell.textLabel!.text = tableData[indexPath.row]
cell.textLabel?.textColor = UIColor.whiteColor()
cell.textLabel?.font = UIFont(name: "HelveticaNeue-Light", size:
return cell
}
而且实现代码如下看起来在模拟器是这样的:
如上所述 - 它看起来正确如果我选择一个iPhone设备作为模拟器。这里是来自iPhone模拟器的图片:
我不知道为什么它在iPad上是白色的而不是在InterfaceBuilder中定义的深灰色(就像在iPhone上一样)?没有什么是“选择”.....我总是使用任何/任何大小类。我在这里奋斗了几天
我很高兴为每一个提示。
在此先感谢。 丹尼尔
在iPhone和iPad上运行时发布图片 – Lamar
您确定表格视图在iPad上有单元格也许白色是桌面视图本身不是单元格@myknack –
请检查您的UITableViewCell背景颜色和单元格contentView背景颜色。可能是你离开了这个视图背景颜色 – bhanu