2

iPod Touch/iPhone에서 회전시키지 말아야하는 응용 프로그램이 있습니다. 그러나 사용자가 버그 리포트를 보낼 수있는 MFMaiComposeViewController가 있습니다. 내 앱이 어떻게 설정 되었는가, 아무 것도 회전 할 수 없으며,이 단일보기를 제외하고는 괜찮습니다. 이것을 어떻게 가로로 만들 수 있습니까?MFMailComposeViewController 만 회전시키는 방법

- (IBAction)sendEmail:(id)sender { 
    NSLog(@"ToolsController - Send Email"); 
    NSString *MailTO = @"[email protected]"; 
    email = [[MFMailComposeViewController alloc] init]; 
    email.mailComposeDelegate = self; 
    NSArray *recipitants = [NSArray arrayWithObject:MailTO]; 
    // Subject 
    [email setSubject:@"Bug/Problem/Suggestion, Logbook iDM"]; 

    [email setToRecipients:recipitants]; 

    // Present it 
    [email setModalPresentationStyle:UIModalPresentationFormSheet]; 
    [email setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; 
    [self presentViewController:email animated:YES completion:nil]; 
} 


- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { 
    [email dismissViewControllerAnimated:YES completion:nil]; 

} 

가 어떻게 만이 뷰가 회전하는 것을 허용 할 수있는하는 .m에서

// 
// LogbookSecondViewController.h 
// Logbook iDM 
// 
// Created by Josiah Bruner on 9/20/12. 
// Copyright (c) 2012 Infinite Software Technologies. All rights reserved. 
// 

#import <UIKit/UIKit.h> 
#import <MessageUI/MessageUI.h> 

@interface LogbookSecondViewController : UIViewController <MFMailComposeViewControllerDelegate> 
{ 
     MFMailComposeViewController *email; 
} 

@property (nonatomic, retain) MFMailComposeViewController *email; 

@end 

: 그것은이 같은 하나 개의 클래스에 선언? 감사.

답변

4

MFMailComposeViewController을 확장하는 MyCustomMailComposeViewController (또는 무엇이든) 클래스를 만듭니다. 이 클래스의 구현에 추가 할 필요가 있습니다 :

// For iOS 6.0+ 
- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskLandscape; 
} 

// For iOS 4.x and 5.x 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 

이 코드는 메일 작곡가 단지 풍경을 원하는 가정합니다. 모든 방향을 원하면 YES를 반환하십시오.

는 다음 변경 :

email = [[MFMailComposeViewController alloc] init]; 

에 :

email = [[MyCustomMailComposeViewController alloc] init]; 
+0

그래, 아마 내가 무엇을 할 것입니다. MFMailComposeViewController에 보낼 수있는 몇 가지 메소드가 필요했지만 그 중 하나는 없다고 생각합니다. 당신의 도움을 주셔서 감사합니다. – Josiah