change color of UITableViewCell after reenabled us

2019-09-12 06:24发布

问题:

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.

回答1:

Are you doing any cell redrawing after the changes? Perhaps you can try calling setNeedsLayout to redraw the cell.