之前用XXView.hidden = YES/NO去控制,怎样都没有出现过渡效果。
[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];
后来改成用透明度去控制就搞定了,,
[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];