開發中用到UIPickerView顯示和隱藏的動畫.隨手記一下
第一步:寫一個動畫方法
- - (void)ViewAnimation:(UIView*)view willHiddenBOOL)hidden {
- [UIView animateWithDuration:0.3 animations:^{
- if (hidden) {
- view.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width, view.bounds.size.height);
- } else {
- [view setHidden:hidden];
- view.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - view.bounds.size.height, [UIScreen mainScreen].bounds.size.width, view.bounds.size.height);
- }
- } completion:^(BOOL finished) {
- [view setHidden:hidden];
- }];
- }