私はいくつかの単語でテーブルビューを持っており、私はデバイスが回転すると、フラッシュカードスタイルの横長ビューを提示します。私は "UIDeviceOrientationDidChangeNotification"を観察して作成しました。罰金とスムーズに動作しますが、問題は、我々は風景の中にあるとき、私は私が横たわっていたことができるようにのViewControllerは、垂直軸周りの回転に反応したくないということですランドスケープビューに正しく切り替えるには?
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(openLandscapeMode) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
1)テーブルの上の電話とそれはまだ景色にあるでしょう。 私は何らかの形で装置向きの代わりに水平方向のスピニングを観察すべきでしょうか?
-(void)openLandscapeMode
{
if([[UIDevice currentDevice]orientation]==UIDeviceOrientationLandscapeLeft||[[UIDevice currentDevice]orientation]==UIDeviceOrientationLandscapeRight)
{
LandscapeCardViewController *landscape = [[LandscapeCardViewController alloc]init];
landscape.words = words;
landscape.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:landscape animated:YES];
NSLog(@"Switch to %@",[[NSUserDefaults standardUserDefaults]valueForKey:@"ChosenWordInCard"]);
[landscape release];
}
else
{
[self dismissModalViewControllerAnimated:YES];
[[UIApplication sharedApplication]setStatusBarOrientation:UIInterfaceOrientationPortrait];
}
}
2)2つ目の質問は別で、当然のことながら、このコントローラは、タブバーにある場合、オブザーバを削除、と私は同じタブバー内の別のコントローラで同じ遷移を実行したいのですが、する場所です風景ビュー? 私はviewWillDissAppearで試しましたが、正しく動作しません。 ありがとう!あなたの最初の質問については
私のコントローラは既にポートレートの向きしかサポートしていませんが、問題は、水平状態にiPhoneを傾けたときに、ポートフォリオにあると言います。向きにしか反応しないと、望ましいスピンコントロールが助けてくれるかもしれませんが、それはジャイロでしか動かないかもしれませんね。 –