当点击背景时,如何动画隐藏选择器视图?试过这个:
[self.picker setHidden:YES];
但是选择器突然消失了。我希望它在屏幕外向下动画。注意:我知道如何实现点击背景以消失部分帖子,所以请忽略它。
当点击背景时,如何动画隐藏选择器视图?试过这个:
[self.picker setHidden:YES];
但是选择器突然消失了。我希望它在屏幕外向下动画。注意:我知道如何实现点击背景以消失部分帖子,所以请忽略它。
[UIView animateWithDuration:0.3 animations:^{
self.picker.center = CGPointMake(self.picker.center.x, self.picker.center.y + self.picker.frame.size.height);
} completion:^(BOOL finished){
self.picker.hidden = YES;
}];
这会将选取器滑到底部,然后在动画结束时将其隐藏。
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3f]; // you can set value as per you need.
[self.picker setHidden:YES];
[UIView commitAnimations];
[UIView animateWithDuration:0.3 animations:^{
self.picker.frame = CGRectMake(self.picker.frame.origin.x,self.picker.frame.origin.y+self.picker.frame.size.height,self.picker.frame.size.width,self.picker.frame.size.height);
}completion:^(BOOL fin) {
}];