如何在翻轉動畫的中途更改UIImageView的圖像。 我的代碼似乎翻轉了UIImageView併成功改變了圖像,但它瞬間改變了。我想達到的目的只是在180度翻蓋達到90度翻蓋後才改變圖像。這裏是我的代碼:更改UIImageView圖像翻轉動畫的一半
在視圖中創建的UIImageView:
UIImage *image = [UIImage imageNamed:@"fb1.jpg"];
imageView = [[UIImageView alloc] initWithImage:image];
vw = [[UIView alloc] initWithFrame:CGRectMake(20, 20, 80, 80)];
vw.layer.cornerRadius = vw.frame.size.width/2;
imageView.frame = CGRectMake(20, 20, 80, 80);
imageView.layer.cornerRadius = imageView.frame.size.width/2;
imageView.layer.masksToBounds = YES;
imageView.layer.borderColor = [[UIColor blackColor] CGColor];
imageView.layer.borderWidth = 1.0;
[self.view addSubview: imageView];
//[self.view addSubview:vw];
[imageView setUserInteractionEnabled:YES];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(taptap:)];
[imageView addGestureRecognizer:tap];
動畫的UIImageView上點擊:
[UIView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut
animations:^(void) {
imageView.transform = CGAffineTransformMakeScale(-1, 1);
[UIView animateWithDuration:1.0 delay:1.0 options:UIViewAnimationOptionTransitionCrossDissolve
animations:^(void) {
imageView.image = [UIImage imageNamed:@"fb2.jpg"];
} completion:^(BOOL finished) {
}];
}
completion:^(BOOL finished) {
}];
而且,我做的具體的UIImageView敲擊手勢這部動畫。
http://stackoverflow.com/questions/1194752/how-can-i-flip-a-uiimageview – iOS
我試圖按照該鏈接上的答案讓我圓的UIImageView平方彈射啓動時。 –