Посмотрел много роликов и примеров.Не могу понять почему не отображаются данные в ячейках. Вот мой код, может поможет кто нибудь из профессионалов мне подсказать мою ошибку?
import UIKit
import Parse
import ParseUI
class SportViewController: BaseViewController {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
addSlideMenuButton()
self.navigationItem.titleView = UIImageView(image: UIImage(named: "uklogo.png"))
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
class SportViewController : PFQueryTableViewController {
override init(style: UITableViewStyle, className: String!) {
super.init(style: style, className: className)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.parseClassName = "betting"
self.textKey = "match"
self.pullToRefreshEnabled = true
self.paginationEnabled = false
}
override func queryForTable()->PFQuery<PFObject> {
let query = PFQuery(className: "betting")
query.order(byAscending: "match")
return query
}
override func viewDidLoad() {
tableView.delegate = self
tableView.dataSource = self
tableView .rowHeight = 150
}
override func viewDidAppear(_ animated: Bool) {
super.viewWillAppear(animated)
tableView.reloadData()
}
func tableView (_tableView: UITableView, cellForRowAt indexPath :IndexPath, object: PFObject?)-> PFTableViewCell {
let cell = tableView.dequeueReusableCell( withIdentifier: "prognozCell") as! EventCell
cell.dataLabel.text = object?.object(forKey: "data") as? String
cell.matchLabel.text = object?.object(forKey: "match") as? String
cell.progLabel.text = object?.object(forKey: "prognoz") as? String
cell.noteText.text = object?.object(forKey: "note") as? String
let imageFile = object?.object(forKey: "image") as? PFFile
cell.imagesP.image = UIImage(named: "sport1")
cell.imagesP.file = imageFile
cell.imagesP.loadInBackground()
return cell
}
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// Return NO if you do not want the specified item to be editable.
return true
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 15
}
func tableView (_tableView:UITableView, heightForRowAt indexPath: IndexPath)-> CGFloat {
if indexPath.row + 1 > (self.objects?.count)! {
return 15
}
let height = super.tableView(tableView, heightForRowAt: indexPath)
return height
}
@IBAction func reloadData(_ sender: Any) {
self.loadObjects()
}
}
}