在屏幕上移动UIImage

时间:2014-08-07 17:11:09

标签: ios objective-c uiimageview uiimage

我有这段代码:

UIImageView *_propLoading;

- (void)viewDidLoad
{
    UIImage *image = [UIImage animatedImageNamed:@"loading" duration:.8f];
    [_propLoading setImage:image];
}

这很有效,但我需要同时在屏幕上移动

我尝试使用此代码但不起作用。

-(void)viewDidAppear:(BOOL)animated{

    [UIView animateWithDuration:2
                          delay:0
                        options:UIViewAnimationOptionCurveEaseIn
                     animations:^{
                         _propLoading.frame = CGRectMake(22, 33, 134, 232);
                     }
                     completion:^(BOOL finished){


                     }];
}

1 个答案:

答案 0 :(得分:2)

尝试:

[UIView transitionWithView:_propLoading
                duration:2.0f
               options:UIViewAnimationOptionTransitionCrossDissolve
            animations:^{
                _propLoading.frame = CGRectMake(22, 33, 134, 232);
                [_propLoading setImage:image];
            } completion:NULL];