0

我正在制作 iPad 应用程序,当我开始单击 beginEditing 时要在其中显示动画,这是我的代码。

-(void)textFieldDidBeginEditing:(UITextField *)textField
{
    NSLog(@"This is calling");
    [self showAnimationPests];
}

-(void) showAnimationPests
{
    [UIView animateWithDuration:0.5
                     animations:^{
                         subView.frame = CGRectMake(0,-200,1024,748);

                     }];
}

它显示正在调用的日志,但视图没有移动。

4

2 回答 2

1

如果它是一个 iphone 应用程序,为什么它的大小1024x748

CGRectMake取点而不是像素(如果您试图弥补视网膜显示)。而 iPhone 5 的这些点是320x568和以前的设备一样320x480

于 2013-08-13T06:59:57.417 回答
0

试试我的波纹管代码

例子..

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    subView.frame = CGRectMake(0,-200,1024,748);
    [UIView commitAnimations];
    return YES;
}

并在下面的方法中设置为默认值 0 textFieldShouldReturn:..

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.3];
        subView.frame = CGRectMake(0,0,1024,748);
        [UIView commitAnimations];
        return YES;
}
于 2013-08-13T06:57:31.767 回答