2013-02-14 73 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。只要您點擊按鈕或其他任何東西,它就會向上移動組件。