Xcode 9 Ios11->;UITableViewController赢得';我什么也没表现出来
我有一个大问题,我已经搜索过了,但没有找到任何东西。 所有这些都工作了,然后我将此代码放在UITableViewController类的Xcode 9 Ios11->;UITableViewController赢得';我什么也没表现出来,ios,swift,uitableview,uiimageview,Ios,Swift,Uitableview,Uiimageview,我有一个大问题,我已经搜索过了,但没有找到任何东西。 所有这些都工作了,然后我将此代码放在UITableViewController类的viewDidLoad()中 let imageView = UIImageView(frame: self.view.frame) let image = UIImage(named: "sample")! imageView.image = image self.tableView.backgroundView = image
viewDidLoad()
中
let imageView = UIImageView(frame: self.view.frame)
let image = UIImage(named: "sample")!
imageView.image = image
self.tableView.backgroundView = imageView
如果我运行它,它只显示背景和单元格中的一些行,但不显示文本:
您的代码将图像放在视图上,而不是放在tableView上。如果你想把它放在tableView上,你需要把它放在单元格上。@MuhammadFauziMasykur但是
self.view
是表格视图,如果这是UITableViewController
。我认为将自定义子视图添加到UITableView中是不正确的…你的tableView和TableViewCells的背景设置为清除吗?是的,我将其全部设置为清除