我有这段代码:
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){
}];
}
答案 0 :(得分:2)
尝试:
[UIView transitionWithView:_propLoading
duration:2.0f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
_propLoading.frame = CGRectMake(22, 33, 134, 232);
[_propLoading setImage:image];
} completion:NULL];