2013-02-14 74 views
0

当我点击按钮时,它显示了选择器视图并隐藏了按钮,用户不知道选择器视图后面发生了什么。如何将按钮上的视图向上移动

任何解决方案: -

像我们有一个文本框的解决方案,该视图时,舞台上与animateTextField文本框的选择。

+0

您的搜索arround有点。 – rptwsthi 2013-02-14 07:32:35

+0

里面的按钮点击方法可以添加 [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.25]; self.view.frame = CGRectMake(0,-10,320,400); [UIView commitAnimations]; – BhushanVU 2013-02-14 07:39:21

+0

CHK答案....... – 2013-02-14 07:54:28

回答

0

可以使用方法动画视图向上移动向上看,并可以使用以下方法向下移动视图:

-(void)animateViewUpward 
    { 
     [UIView beginAnimations: @"upView" context: nil]; 
     [UIView setAnimationDelegate: self]; 
     [UIView setAnimationDuration: 0.4]; 
     [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; 
     self.view.frame = CGRectMake(0,-110, 320,460); 
     [UIView commitAnimations]; 
    } 

    -(void)animateViewDownward 
    { 
     [UIView beginAnimations: @"downView" context: nil]; 
     [UIView setAnimationDelegate: self]; 
     [UIView setAnimationDuration: 0.4]; 
     [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; 
     self.view.frame = CGRectMake(0,0, 320,460); 
     [UIView commitAnimations]; 
    } 
0

在点击按钮使用动画

[UIView animateWithDuration:2.0 
        animations:^{ 
         self.view.frame = CGRectMake(0,-30,320,400); 
        } 
        completion:^(BOOL finished){ 
         ; 
        }]; 

当你按完成或工具栏的取消或者正在选择器选择做

[UIView animateWithDuration:2.0 
        animations:^{ 
         self.view.frame = CGRectMake(0,0,320,400); 
        } 
        completion:^(BOOL finished){ 
         ; 
        }]; 
0

您可以dd视图中的UIKeyboardScrollView。只要您点击按钮或其他任何东西,它就会向上移动组件。