1つのグラフビューとその内部のセグメント化されたコントロールを備えた1つのビューコントローラーセットがあります。ビューを水平に回転させる方法は?また、水平方向の別のビューをロードすることは可能ですか?
事前にThx、Mladen
1つのグラフビューとその内部のセグメント化されたコントロールを備えた1つのビューコントローラーセットがあります。ビューを水平に回転させる方法は?また、水平方向の別のビューをロードすることは可能ですか?
事前にThx、Mladen
オリエンテーションサポートは、次の方法で実装します。
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
// Just delete the lines for the orientations you don't want to support
if((toInterfaceOrientation == UIInterfaceOrientationPortrait) ||
(toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)) ||
(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft)) ||
(toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
return YES;
}
return NO;
}
次に、回転時に新しいViewControllerをロードするには:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if((fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
(fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight))
{
// Load the view controller you want to display in portrait mode...
}
}
iPodアプリがCoverFlowモードに移行するときに見られるように、スムーズな移行を行いたい場合は、新しいビューのalphaプロパティを操作するアニメーションを設定することもできます。
免責 事項3.0でのインターフェイスローテーションの変更をサポートするための推奨される方法。上記の方法は引き続き機能しますが、よりスムーズなアニメーションを取得する方法があります。しかし、ここでそれについて話すことは想定されていません。もっと。週。
ANOTHERvDISCLAIMER インターフェイスの回転をサポートするための推奨される方法は、6.0で再び変更されます。上記の方法は引き続き機能しますが、よりスムーズなアニメーションを取得する方法があります。
デバイスの回転については、viewControllerに次のメソッドを実装する必要があります。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation