찾다

 >  Q&A  >  본문

ios - 如何实现图片的3D旋转,而且是不停旋转?

我的代码是这样的:

//  ViewController.m
//  核心动画
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@end
@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [UIView  animateWithDuration:3 animations:^{
self.imageView.layer.transform=CATransform3DMakeRotation(M_PI, 0, 1,1);
    }]; 
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
@end

但是这样做旋转了一次就不在旋转了。请问如何实现不停的旋转呢?(按照Y轴)

伊谢尔伦伊谢尔伦2867일 전641

모든 응답(2)나는 대답할 것이다

  • 怪我咯

    怪我咯2017-04-17 16:13:42

    으아아아

    회신하다
    0
  • 阿神

    阿神2017-04-17 16:13:42

    LZ의 코드는 Y를 따라 회전하지 않습니다. Y와 Z가 동시에 이동합니다. 참고로 두 가지 방법이 있는데 전환이 더 부드럽고 자연스럽기 때문입니다. .
    방법 1:

    으아아아

    방법 2:

    으아아아

    회신하다
    0
  • 취소회신하다