Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在按下背景时设置隐藏选择器视图的动画_Ios_Objective C_Uipickerview - Fatal编程技术网

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;
}];