详细信息(副标题)文本不会出现。但是,数据是可用的,因为当添加 println() 调用时,它会将 Optional("data") 与预期数据一起打印到控制台。在 Storyboard中,UITableViewController 设置为适当的类,Table View Cell Style 设置为“Subtitle”,重用标识符设置为“cell”。如何获取显示的字幕信息?
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell
dispatch_async(dispatch_get_main_queue(), { () -> Void in
cell.textLabel.text = self.myArray[indexPath.row]["title"] as? String
cell.detailTextLabel?.text = self.myArray[indexPath.row]["subtitle"] as? String
println(self.myArray[indexPath.row]["subtitle"] as? String)
// The expected data appear in the console, but not in the iOS simulator's table view cell.
})
return cell
}
最佳答案
关于UITableViewCell 不显示 detailTextLabel.text - Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27221003/