0

I'm editing a table in iOS Swift 2 using UITableViewRowAction. If they select the action after the action button pops up, I want the current background of the whole cell (not the button popup) to change color. I try accessing it using dequeueReusableCellWithIdentifier but nothing is happening.

let share = UITableViewRowAction(style: .Normal, title: "Showed Up?") { (action, indexPath) in

let cell = tableView.dequeueReusableCellWithIdentifier("secondtableCell", forIndexPath: indexPath) 
cell.backgroundColor = UIColor.redColor()

...the code continues to close later of course. Everything works as expected besides the color change.

4

1 回答 1

1

你在你的ViewDidLoad方法中注册了这个类吗?如果没有,请继续执行此操作并告诉我您得到了什么。

self.tableViewController.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell")
于 2015-12-04T18:22:12.897 回答