重新启用用户交互后更改 UITableViewCell 的颜色
在我的应用程序中,我有一些菜单点,这些菜单点无法进行用户交互。
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];
但最后一行代码不起作用 - 文本像以前一样是灰色的。
in my app, i've some menupoints, that are disabled for userinteraction.
cell.userInteractionEnabled = FALSE;
after the login, i want to reenable some of these cells.
this snippet is working half the way:
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];
but the last line of code is not working - the text is gray as before.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改后您是否正在重绘单元格?也许您可以尝试调用 setNeedsLayout 来重绘单元格。
Are you doing any cell redrawing after the changes? Perhaps you can try calling setNeedsLayout to redraw the cell.