我已阅读大量问题,但似乎无法找到答案
我有一个 TableView 但无法将图像添加到我的单元格
cell.imageView.image = UIImage(named: "osx_design_view_messages")
这段代码应该可以工作,因为我基本上是从问题的答案中复制了它,但由于某种原因它不起作用。有什么建议么?
顺便说一句,我正在使用 swift
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!
{
let cellIdentifier = "cell"
var cell : UITableViewCell
cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier) as UITableViewCell
cell.textLabel.text = self.recipies[indexPath.row]
var image : UIImage = UIImage(named: "osx_design_view_messages")
return cell
}