简体   繁体   English

在屏幕上移动UIImage

[英]Move UIImage around the screen

I have this code: 我有以下代码:

UIImageView *_propLoading;

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

This works perfectly, but i need move around screen at the same time 这很完美,但是我需要同时在屏幕上移动

i try this code but not works. 我尝试此代码,但不起作用。

-(void)viewDidAppear:(BOOL)animated{

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


                     }];
}

Try: 尝试:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM