[英]What can I do to access this Table View within a View Controller?
我已經查看了其他帖子,但不確定此處的下一步。 這是我目前所擁有的。 我是否需要在其他地方添加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
}
/
}
然后,我為連接建立了此設置,但似乎無法使“表視圖”識別我要輸出的任何數據。
我也有`LookbookPostViewCell類:UITableViewCell {
@IBOutlet weak var postLabel: UILabel!
}`
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.