0

ユーザーがデータを入力すると、ビューがスライドアップする必要があるアプリがあります。このコードを書いていますが、このコードは別のアプリでは正常に動作しますが、このアプリでは動作しません。同じ方法に従っています。

-(void)showAnimationBack{

    NSLog(@"Back Animation is Working");


    [UIView animateWithDuration:0.5 
                     animations:^{
                         self.subViewLand.frame = CGRectMake(0,-10,1024,768);


                     }];

}


-(void) showAnimationPests{


    NSLog(@" Animation is Working");


    [UIView animateWithDuration:0.5 
                     animations:^{
                         self.subViewLand.frame = CGRectMake(0,-200,1024,768);


                     }];


}
4

3 に答える 3

1
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];
    self.subViewLand.frame  = CGRectMake(0,-200,1024,768); // or to self.view.frame  = CGRectMake(0,-200,1024,768);
    [UIView commitAnimations];
}

- (void)textFieldDidEndEditing:(UITextField *)textField{
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.5];
        self.subViewLand.frame = CGRectMake(0,-200,1024,768); // or to self.view.frame  = CGRectMake(0,-200,1024,768);
        [UIView commitAnimations];
} 

このコードは機能します

于 2013-03-13T06:17:05.950 に答える
0

in textfielddidBeginEditing メソッドは、このようにビュー フレームを設定します

 - (void)textFieldDidBeginEditing:(UITextField *)textField
{
   [self.subViewLand setFrame:CGRectMake(0, -200, 320, 480)];
}

in textfielddidEndEditing メソッドでビュー枠をそのまま設定。

- (void)textFieldDidEndEditing:(UITextField *)textField{
    [self.subViewLand setFrame:CGRectMake(0, 0, 320, 480)];
} 

それは間違いなくうまくいくでしょう。:)

于 2013-03-13T06:16:26.457 に答える
0

textFieldDidBeginEditing()your メソッドshowAnimationPests()を呼び出し、同様にcalltextFieldDidEndEditing()を呼び出しますshowAnimationBack()

これはうまくいきます。

于 2013-03-13T06:22:32.217 に答える