2011-11-01 38 views
0

後,更改了UITableViewCell的顏色,我有一些menupoints,它們禁用了用戶交互。在我的應用程序中重新啓用用戶交互

cell.userInteractionEnabled = FALSE; 

登錄後,我想重新啓用一些這些單元格。

這個片斷是一半的工作方式:

NSIndexPath *editUsersPath = [NSIndexPath indexPathForRow:0 inSection:1]; 
     [self.tableView cellForRowAtIndexPath:importPath].userInteractionEnabled = YES; 
     [self.tableView cellForRowAtIndexPath:importPath].accessoryType =   UITableViewCellAccessoryDisclosureIndicator; 
     [self.tableView cellForRowAtIndexPath:importPath].textLabel.textColor = [UIColor blackColor]; 

但最後一行代碼不工作 - 文本是灰色的了。

回答

0

你在做任何單元格重繪後的變化?也許你可以嘗試調用setNeedsLayout來重繪單元格。

+0

我試過了 - 但textcolor沒有變化。順便提一句:我可以改變背景顏色... – Adrian

+0

設置好userInteractionEnabled後,是否userInteractionEnabled實際上是YES?在該行之前和之後拋出一個NSLog,並查看該值是否正確更新。 – Remear

+0

我還看到另一篇關於您可能想要查看的類似問題的文章。 http://stackoverflow.com/questions/7793491/uitableviewcell-textcolor-will-not-change-with-userinteractionenabled-no – Remear

相關問題