【发布时间】:2018-09-16 03:13:37
【问题描述】:
我已经查看了其他帖子,但我不确定接下来的步骤。这是我目前所拥有的。我需要在其他地方添加一个 tableView 变量吗?连接不同的东西?
class LookbookPostViewController: UIViewController {
@IBOutlet weak var titleLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
titleLabel.text = postArray[myIndex].title
// Do any additional setup after loading the view.
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
@IBOutlet weak var tableView: UITableView!
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
return postArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "postViewCell", for: indexPath) as! LookbookPostViewCell
cell.postLabel.text = postArray[indexPath.row].title
print(postArray)
return cell
}
/
}
然后我为我的连接设置了这个,但似乎无法让表格视图识别我尝试输出的任何数据。
我也有`class LookbookPostViewCell: UITableViewCell {
@IBOutlet weak var postLabel: UILabel!
} `
【问题讨论】:
标签: ios swift uitableview tableview