사진 앱의 의미를 이해하지 못하고보기를 회전 할 수있는 방법이 너무 많습니다. 기본적으로 2 가지 방법이 있습니다 : 첫 번째 방법은 다음 예에서와 같이 CGTransformation을 적용하는 것입니다 :
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[imgView setImage:[UIImage imageNamed:@"polaroid_spacer"]];
[self addSubview: imgView];
[UIView animateWithDuration:0.3f delay:5.f options:UIViewAnimationOptionCurveEaseIn animations:^{
[imgView setTransform:CGAffineTransformMakeRotation(M_PI_2)];
} completion:NULL];
다른 방법은 뷰의 레이어에 CATransform을 적용하는 것입니다 :
//be sure to include quartz
#import <QuartzCore/QuartzCore.h>
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[imgView setImage:[UIImage imageNamed:@"polaroid_spacer"]];
[self addSubview: imgView];
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform"];
[anim setToValue: [NSValue valueWithCATransform3D: CATransform3DMakeRotation(M_PI_2, 0, 0, 1)]];
[anim setDuration: 3.f];
[anim setBeginTime: (CACurrentMediaTime() + 5.f)];
[imgView.layer addAnimation:anim forKey:@"myAwesomeAnim"];
모두 이 작업을 수행하는 데 사용할 수 있습니다. Core Animation에 대해 잘 모르는 경우 Core Graphics를 사용해야합니다. 예를 들어 UIView 애니메이션을 사용할 수 있기 때문에 결과를 얻는 것이 더 쉽습니다.
사진 앱에서 의미하는 바는 사과 자신의 사진 앱에서 사진을보고 수정을 클릭하는 것입니다. 그런 다음 화살표를 클릭하여 이미지를 회전하면 의미를 알 수 있습니다. –
아, 이제 알겠습니다. 하지만 네, 제가 설명한대로 그렇게 할 수 있습니다. 그러나 그들은 단지 회전하는 것이 아니라 이미지를 스케일링하는 것입니다. – Lukas