UITableviewCell accessoryView无法更改

时间:2015-07-22 10:07:09

标签: ios iphone swift uitableview uiaccessoryview

我需要将accessoryView更改为正确的UIImageView

"INSERT INTO 'timesheets' (clientid, candid, weekending, department, orderno, basicpay, basiccharge, otpay, otcharge, ot2pay, ot2charge, status, hue, huc) 
VALUES ('$client', '$cand', '$week_ending', '$department', '$order_no', '$basic_pay', '$basic_charge', '$ot_pay', '$ot_charge', '$ot2_pay', '$ot2_charge', '$status', '$hue', '$huc')

我在调试中检查过,有时我会设置"崩溃"图像,有时"编辑"图像,但在那之后我总是看到"编辑"细胞中的图像。

因此,当我在开始时设置accessoryView时,我无法在此之后更改它(实际上我可以更改视图指针,但在屏幕上之后我不会看到任何更改)

2 个答案:

答案 0 :(得分:1)

我认为您可能必须在if currentlyExpanded {进行cellForRowAtIndex检查,然后只需拨打self.tableView.reloadData中的didSelectRowAtIndex

答案 1 :(得分:1)

我找到了解决方案。问题在于:

var cell = tableView(self.tableViewMain, cellForRowAtIndexPath: indexPath) as! ActivitySectionCell

我不得不将其更改为:

var cell = tableViewMain.cellForRowAtIndexPath(indexPath) as! ActivitySectionCell

因为否则我将不会更改当前单元格,而是更改其他返回单元格