简体   繁体   中英

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];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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