I have implemented a subclass of UITableViewCell called UITableViewCellCustom. When entering in editing mode or when I swipe the cell to display the delete button I want to hide a label from my cell and display it when exiting the editing mode.
I have implemented the following code in the UITableViewCellCustom
- (void)willTransitionToState:(UITableViewCellStateMask)state {
[super willTransitionToState:state];
if ((state == UITableViewCellStateShowingDeleteConfirmationMask) || (state == UITableViewCellStateShowingEditControlMask)) {
[UIView animateWithDuration:0.5
animations:^{rankLabel.alpha = 0.0;}];
}
}
- (void)didTransitionToState:(UITableViewCellStateMask)state {
[super didTransitionToState:state];
if (state == UITableViewCellStateDefaultMask) {
[UIView animateWithDuration:0.5
animations:^{rankLabel.alpha = 1.0;}];
}
}
I have two issues.
-
For example if I have 23 rows in my tableview. When my first 5 rows are displayed I enter to the edit mode. My rankLabel is hidden and then I’m scrolling to the bottom of my table (to row 23) and I’m exiting from the edit mode. The rankLabel is displayed again but not for all cells, my cells 6 / 12 and 18 are not refreshed correctly. Any idea?
-
In method
willTransitionToStateI’m usinganimateWithDurationto hide softly my rankLabel but it doesn’t work, the rankLabel is hidden but without transition. The same method works very well indidTransitionToStatewhen I want to show again the label. Any idea?
Thanks for your support.
For #2: