インターフェイス全体を回転させるのではなく、紫と赤の正方形を個別に回転させようとしているという質問を理解しています。
UIViewController
あなたのレイアウトに似た を作成しました。

黒い四角は UIView で、白い四角は黒いビューがいつ回転するかを知るためだけに存在します。このビューはview1
、コントローラーのプロパティに接続されています。
btnx
(x run 1 から 4) プロパティに接続されている 4 つのボタンがあります。
インターフェイスを自動回転させたくないので、縦向きのみをサポートします。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
回転を手動で行うために、ViewController にメソッドを追加しました。コンポーネントを縦向きから現在の向きに回転するために必要な角度を決定し、回転変換を作成して、それをすべてのアウトレットに適用します。
- (void)deviceDidRotate:(NSNotification *)notification
{
UIDeviceOrientation currentOrientation = [[UIDevice currentDevice] orientation];
double rotation = 0;
UIInterfaceOrientation statusBarOrientation;
switch (currentOrientation) {
case UIDeviceOrientationFaceDown:
case UIDeviceOrientationFaceUp:
case UIDeviceOrientationUnknown:
return;
case UIDeviceOrientationPortrait:
rotation = 0;
statusBarOrientation = UIInterfaceOrientationPortrait;
break;
case UIDeviceOrientationPortraitUpsideDown:
rotation = -M_PI;
statusBarOrientation = UIInterfaceOrientationPortraitUpsideDown;
break;
case UIDeviceOrientationLandscapeLeft:
rotation = M_PI_2;
statusBarOrientation = UIInterfaceOrientationLandscapeRight;
break;
case UIDeviceOrientationLandscapeRight:
rotation = -M_PI_2;
statusBarOrientation = UIInterfaceOrientationLandscapeLeft;
break;
}
CGAffineTransform transform = CGAffineTransformMakeRotation(rotation);
[UIView animateWithDuration:0.4 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
[self.btn1 setTransform:transform];
[self.btn2 setTransform:transform];
[self.btn3 setTransform:transform];
[self.btn4 setTransform:transform];
[self.view1 setTransform:transform];
[[UIApplication sharedApplication] setStatusBarOrientation:statusBarOrientation];
} completion:nil];
}
最後に行うことは、OS にメソッドを呼び出させることです。application:didFinishLaunchingWithOptions:
それを実現するために、AppDelegate に次のコードを追加しました。
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self.viewController selector:@selector(deviceDidRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
これがまさにあなたが望んでいたものかどうかはわかりませんが、少なくとも似ているので、問題を解決する方法についていくつかのアイデアを得ることができると思います. これを説明するために作成した動作中の iPad アプリケーションのソース コードを提供できます。