Ios 如何在按下背景时设置隐藏选择器视图的动画
如何在点击背景时设置隐藏选择器视图的动画?我试过这个:Ios 如何在按下背景时设置隐藏选择器视图的动画,ios,objective-c,uipickerview,Ios,Objective C,Uipickerview,如何在点击背景时设置隐藏选择器视图的动画?我试过这个: [self.picker setHidden:YES]; 但是拾荒者突然消失了。我希望它在屏幕外向下设置动画。 注意:我知道如何实现点击背景以消失帖子的一部分,所以请忽略它 [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3f]; // you can set value as per you need. [self.pick
[self.picker setHidden:YES];
但是拾荒者突然消失了。我希望它在屏幕外向下设置动画。
注意:我知道如何实现点击背景以消失帖子的一部分,所以请忽略它
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3f]; // you can set value as per you need.
[self.picker setHidden:YES];
[UIView commitAnimations];
这会将拾取器滑到底部,然后在动画结束时将其隐藏。不能添加CGPoint和CGFloat。这段代码甚至无法编译。
[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) {
}];
[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;
}];