【发布时间】:2014-06-07 06:58:31
【问题描述】:
我已经阅读了大量问题,但似乎找不到答案
我有一个 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
}
【问题讨论】:
-
你能发布你的整个 cellForRowAtIndexPath 函数吗?
标签: uitableview swift xcode6