5

私のアプリはランドスケープベースです。横向きでMFMailComposeViewControllerを使用したいのですが、向きについて通知するものが見つかりません。横向きの場合、MFMailComposeViewControllerは、横向きの場合、左側から入ってくるメール作成ウィンドウの上部のみを表示します。基本的に、横向きの画面の半分をカバーします。メール作成ウィンドウを縦向きではなく横向きに表示する方法はありますか?

---編集---メール作成をロードしたいビューは次のように導出されます。

//from first UIViewController
[self presentModalViewController:secondView animated:YES];

//from secondView (a UIViewController), I load the info view, which is where the mail compose shows
InfoController *infoController = [[InfoController alloc] initWithNibName:@"Info" bundle:[NSBundle mainBundle]];
[self.view addSubview:infoController.view];

上記から、メール作成の親ビューは3番目に読み込まれます。info.plistで、私はこれを行います:

UIInterfaceOrientation = UIInterfaceOrientationLandscapeRight
4

5 に答える 5

7

Application Delegate クラスの実装に次のコードを追加して、メール コンポーザー ビュー コントローラーによる自動回転をオーバーライドできます。

@interface MFMailComposeViewController (AutoRotation)
// to stop auto rotation
@end

@implementation MFMailComposeViewController (AutoRotation)
// stop auto rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // should support all interface orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
于 2011-01-05T12:01:11.220 に答える
6

ネストされた UIViewController に MailViewController を表示する場合は、メインの UIViewController に表示してみてください。これで問題は解決しました。メインコントローラーをメインコントローラーに渡しました。

于 2009-11-19T14:51:14.187 に答える
0

私は横向きのアプリを持っており、MFMailComposeViewController を表示するとうまくいくようです...

UIImagePickerControllerが横向きモードで機能しないため、アプリを縦向きモードに切り替える必要がある場合があるため、ビューで次のコードを使用して横向きモードを再設定します...

self.bounds = CGRectMake(0, 0, 480, 320);
self.center = CGPointMake(160, 240);
self.transform = CGAffineTransformMakeRotation(M_PI / 2);

MFMailComposeViewController はこれらの値を取得し、それ自体を表示する方法を認識している必要があります。

于 2009-07-09T02:58:41.273 に答える
0

"presentModalViewController:" をアプリケーション ウィンドウの rootViewController (AppDelegate 内) に送信してみてください。

MFMailComposeViewController は rootViewController の向きを強制することはできませんが、rootViewController の navigationController によってプッシュされた viewController の向きを強制することはできるため、これでうまくいくと思います。

次のようなものが必要です。

    [((AppDelegate *)[UIApplication sharedApplication]).window.rootViewController presentViewController:mailVC animated:YES];
于 2013-08-29T08:15:56.487 に答える
-1

これは私のために働く...

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    //    return (YES);
    return (interfaceOrientation==UIInterfaceOrientationLandscapeRight);
}

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation))
    {
        ......
    }
}    
于 2011-03-22T12:38:37.250 に答える