1
我在自己的單元中有一個自定義UIImage
,我需要在調用didSelectRowAtIndexPath
時進行更改。出於某種原因,圖像沒有改變,我認爲這是因爲我的單元格聲明在方法中。在didSelectRowAtIndexPath中更改自定義UIImage
class CustomCell: UITableViewCell {
@IBOutlet weak var indicator: UIImageView!
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
var cell = tableView.dequeueReusableCellWithIdentifier("CustomCell", forIndexPath: indexPath) as! CustomCell
cell.indicator.image = UIImage(named: "newImage")
}
當單擊單元格時,如何將UIImage
更改爲「newImage」?