Reputation: 411
I have a custom UIControl
which can have two custom states -> customEnabled
/ customDisabled
. State change of this UIControl
results technically in hiding / displaying defined view for the state set. Work fine so far.
When using within the UITableView
I have the following problem: When reusing a cell with enabled control for a cell, where control is disabled I see for a short time the enabled and then disabled control.
State setting is happening in the cellForRowAtIndexPath
method of the UITableViewController
. The setter for the state shows / hides the views.
Does anyone have an idea how to get the appropriate appearance without "animation"?
Upvotes: 0
Views: 460
Reputation: 42588
I was going to suggest something similar
[UIView setAnimationsEnabled:NO];
[UIView animateWithDuration:0.0 animations:^{
// Code with animations turned off
} completion:^(BOOL finished){
[UIView setAnimationsEnabled:YES];
}];
Upvotes: 0
Reputation: 4125
Wrap your showing/hiding in the following
[CATransaction begin];
[CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions];
// do show/hide
[CATransaction commit];
Upvotes: 1