이 개념을 이해하는 데 다소 시간이 걸렸습니다. 나는 같은 이미지의 초상화와 풍경을 만들고 싶지 않았다. 여기서 핵심은 CGAffineTransformMakeRotation
이 UIImageView의 원래 상태 또는 UIView에서 회전한다는 것입니다. 이것은 배경 이미지에 방향이 있다고 가정합니다. 예 : UIImageView를 그대로 유지하고 다른 객체는 정상적인 방향 변경 이벤트로 동작해야합니다.
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
backgroundImage.transform = CGAffineTransformMakeRotation(M_PI/2);
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight){
backgroundImage.transform = CGAffineTransformMakeRotation(-M_PI/2);
}
else {
backgroundImage.transform = CGAffineTransformMakeRotation(0.0);
}
}
- (void)viewDidLoad {
[super viewDidLoad];
//set the UIImageView to current UIView frame
backgroundImage.frame = self.view.frame;
}
같은 풍경을 피하고 싶습니다. 이 작업을 수행하는 적절한 방법 UIImageView 사용하고 있습니까? – docchang
배경 이미지를 고정시키고 나머지 UI를 회전시키는 방법이 있습니까? – docchang
예, 이미지 뷰를 사용해보세요. 효과가있을 것입니다. 하지만 볼 당 프레임을 설정해야합니다 .. 내가 원하는 말을하고 싶습니다 .. –