2

当点击背景时,如何动画隐藏选择器视图?试过这个:

[self.picker setHidden:YES];

但是选择器突然消失了。我希望它在屏幕外向下动画。注意:我知道如何实现点击背景以消失部分帖子,所以请忽略它。

4

3 回答 3

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

这会将选取器滑到底部,然后在动画结束时将其隐藏。

于 2013-03-24T09:54:01.057 回答
1
[UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.3f]; // you can set value as per you need.
    [self.picker setHidden:YES];
    [UIView commitAnimations];
于 2013-03-24T09:51:26.327 回答
1
[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) {

}];
于 2013-03-24T09:53:14.087 回答