私はこれについて多くのことを検索してきましたが、私を助けるものは何も見つかりません。
別の UIViewController 内に UIViewController が含まれています。親 UIViewController が回転するとき、たとえば Portrait から LandscapeLeft に、子が回転していないように見せたいと思います。ということです。親の向きに関係なく、子供が空に対して同じ向きになるようにします。ポートレートで直立したUIButtonがある場合、ボタンの右側がUIInterfaceOrientationLandscapeLeftで「上」になるようにします。
これは可能ですか?現在、私は次のような本当にひどいことをしています:
-(void) rotate:(UIInterfaceOrientation)fromOrientation: toOr:(UIInterfaceOrientation)toOrientation
{
if(((fromOrientation == UIInterfaceOrientationPortrait) && (toOrientation == UIInterfaceOrientationLandscapeRight))
|| ((fromOrientation == UIInterfaceOrientationPortraitUpsideDown) && (toOrientation == UIInterfaceOrientationLandscapeLeft)))
{
}
if(((fromOrientation == UIInterfaceOrientationLandscapeRight) && (toOrientation == UIInterfaceOrientationPortraitUpsideDown))
|| ((fromOrientation == UIInterfaceOrientationLandscapeLeft) && (toOrientation == UIInterfaceOrientationPortrait)))
{
}
if(((fromOrientation == UIInterfaceOrientationPortrait) && (toOrientation == UIInterfaceOrientationLandscapeLeft))
|| ((fromOrientation == UIInterfaceOrientationPortraitUpsideDown) && (toOrientation == UIInterfaceOrientationLandscapeRight)))
{
}
if(((fromOrientation == UIInterfaceOrientationLandscapeLeft) && (toOrientation == UIInterfaceOrientationPortraitUpsideDown))
|| ((fromOrientation == UIInterfaceOrientationLandscapeRight) && (toOrientation == UIInterfaceOrientationPortrait)))
{
}
if(((fromOrientation == UIInterfaceOrientationPortrait) && (toOrientation == UIInterfaceOrientationPortraitUpsideDown))
|| ((fromOrientation == UIInterfaceOrientationPortraitUpsideDown) && (toOrientation == UIInterfaceOrientationPortrait)))
{
}
if(((fromOrientation == UIInterfaceOrientationLandscapeLeft) && (toOrientation == UIInterfaceOrientationLandscapeRight))
|| ((fromOrientation == UIInterfaceOrientationLandscapeRight) && (toOrientation == UIInterfaceOrientationLandscapeLeft)))
{
}
}
これは完全に無駄なコードのように思えます。さらに、私は CGAffineTransform を使用することを計画していました (ここで引用されているように: http://www.crystalminds.nl/?p=1102 )が、ビューの寸法を変更して回転後の寸法に合わせるべきかどうかについて混乱しています.
ここでの大きな悪夢は、グローバルな「方向」変数を追跡しなければならないことです。そうしないと、錯覚が失われ、ViewController が何にでも回転します。
私は本当にこれでいくつかの助けを借りることができました、ありがとう!