我是 ios/swft 的新手,遇到了在表格 View 中显示分隔符的问题。 我已经花了几天时间尝试了几乎所有的建议,但没有一个对我有用。 我正在动态插入单元格,在这种情况下分隔符消失了。 在我正在使用的代码下方。
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
let tableData = ["One","Two","Three"]
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
tableView.delegate = self
tableView.dataSource = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return tableData.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell")!
cell.textLabel?.text = tableData[indexPath.row]
return cell
}
}
在 Storyboard上,它是 View 上的简单 TableView ,没什么特别的。
这真的很烦我,请帮助修复它。
最佳答案
原来问题只出现在模拟器上,而不是实际设备上。
关于ios - Swift UITableView 分隔符不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35150933/