【发布时间】:2016-10-04 23:11:26
【问题描述】:
问题:image of UITableViewCells that never display data without being selected.
该问题足够一致,即使禁用用户触摸交互仍然会导致出现此问题。这些行应该有 3 个子行,但只显示了该部分的末尾(连同标题,如图所示)。
这个表格视图的代码:
import UIKit
class HistoryViewController : UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet var tableview: UITableView!
var data = LocalizedData.localizedData
let cellReuseIdentifier = "tableCell"
override func viewDidLoad() {
super.viewDidLoad()
tableview.delegate = self
tableview.dataSource = self
//tableview.allowsSelection = true
tableview.allowsMultipleSelection = true
if AppDelegate.debug {
print("HistoryViewLoaded")
}
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
tableview.reloadData()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section:Int) -> Int {
return data.getMatchDataCount()
}
func tableView(_ tableView:UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "tableCell", for: indexPath) as! HistoryViewTableCell
if !AppDelegate.device.isEqual(to: 4.0) {
cell.textLabel?.text = "Entry " + (indexPath.item + 1).description
}
if data.getMatchDataCount() > 0 {
cell.matchNumb?.text = data.getMatchTest(matchNumber: indexPath.item)[1].description
cell.teamNumb?.text = data.getMatchTest(matchNumber:indexPath.item)[0].description
}
return cell
}
}
class HistoryViewTableCell: UITableViewCell {
@IBOutlet weak var teamNumb: UILabel!
@IBOutlet weak var matchNumb: UILabel!
@IBOutlet weak var matchPoints: UILabel!
}
【问题讨论】:
标签: uitableview swift3 ios10