Previously, XXView. hidden = YES/NO was used to control the transition.
[UIView animateWithDuration:0.4 animations:^{ if (_summaryView.hidden) { _summaryView.hidden = NO; _summaryDetailTable.hidden = YES; }else{ _summaryView.hidden = YES; _summaryDetailTable.hidden = NO; } } completion:^(BOOL finished) { }]; [_buttonDetailSummary setTitle:(_summaryView.hidden?@"Detail":@"Summary") forState:UIControlStateNormal];
Later, we changed to using transparency for control ,,
[UIView animateWithDuration:0.4 animations:^{ if (_summaryView.hidden) { _summaryDetailTable.alpha = 0.0; _summaryView.alpha = 1.0; }else{ _summaryDetailTable.alpha = 1.0; _summaryView.alpha = 0.0; } } completion:^(BOOL finished) { _summaryView.hidden = !_summaryView.hidden; _summaryDetailTable.hidden = !_summaryDetailTable.hidden; }]; [_buttonDetailSummary setTitle:(_summaryView.hidden?@"Detail":@"Summary") forState:UIControlStateNormal];