使用MFMailComposeViewController工作正常时,手机处于UIInterfaceOrientationPortrait,但是如果我不容许自转我得到这样的事情,当用户旋转手机:MFMailComposeViewController空白屏幕当横向开度模式
所以我决定让视图控制器(这也是一个模式的看法),是调用模式视图旋转视图的一部分:
RootAppInfoViewController.h
#import <UIKit/UIKit.h>
@interface RootAppInfoViewController : UIViewController <UINavigationControllerDelegate>{
UINavigationController *navigationControl;
}
@property (nonatomic,retain) IBOutlet UINavigationController *navigationControl;
//dismisses this modal view
- (IBAction)selectHome:(id)sender;
@end
RootAppInfoViewController.m
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
(具有这种自动旋转允许旋转由方式这整个视图)。但是,这仅仅是一个视图控制器,我想一个表视图,以呈现模态,所以我有这个类,这是通过RootAppInfoViewController.xib引用这使得这种模式视图表格视图:
AppInfoViewController.h
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@interface AppInfoViewController : UITableViewController <MFMailComposeViewControllerDelegate, UINavigationControllerDelegate> {
NSMutableArray *dataSourceArray;
}
@property(nonatomic, retain) NSMutableArray *dataSourceArray;
@end
AppInfoViewController.m
//..
/* //NOTE: Commenting or uncommenting this block of code has no effect!
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}//*/
//...
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NSString *source = [[[self.dataSourceArray objectAtIndex:indexPath.section] objectForKey:kSourceKey] objectAtIndex:indexPath.row];
if(indexPath.section == kFeedbackSection) {
if([MFMailComposeViewController canSendMail]) {
// fill out email
//...
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
//MailCompose *controller = [[MailCompose alloc] init];
controller.mailComposeDelegate = self;
[[controller navigationBar] setTintColor:[UIColor oceanColor]];
[controller setToRecipients:[NSArray arrayWithObject:kFeedbackEmail]];
[controller setSubject:emailSubject];
[controller setMessageBody:emailBodyTemplate isHTML:NO];
[self presentModalViewController:controller animated:YES];
[controller release];
} else {
[UIAlertHelper mailErrorAlert];
}
} //...
}
#pragma mark -
#pragma mark MFMailComposeViewControllerDelegate methods
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
[self dismissModalViewControllerAnimated:YES];
}
评论或不注释掉这一类的自转代码没有任何影响。保持设备直立并点击加载MFMailComposeViewControlleryeilds的行没有问题,它加载直立,然后它旋转得很好。然而,加载表视图,保持它侧身,然后轻敲与MFMailComposeViewController行加载模态视图控制器作为一个空白屏幕:
发生这种情况无论是在模拟器和实际的物理设备。
任何人都知道这是怎么回事?提前致谢!
你是否设法解决这个问题呢?我发现很相似的问题。 – sarunw 2012-03-09 15:16:55
我是通过向苹果发送技术服务事件做到的。我会很快发布修复。感谢您的提醒。 – Stunner 2012-03-09 19:59:33
@Stunner什么是修复? – 2013-05-24 14:41:38