views:

21

answers:

1

I'm using the following code in two view controllers; one, where it is triggered by pressing a button, and another, where it is triggered by tapping a table cell. In the first, it works fine.

In the second, triggered by the table-cell tap, the mail composer appears, with the fields correctly filled out, but the cursor and keyboard do not appear, so you can't actually enter anything into the mail message. (You can hit Cancel or Send without problems.) Any idea what's wrong? Thanks!

if ([MFMailComposeViewController canSendMail]) {
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    [picker setSubject:@"Message subject"];
    [picker setMessageBody:@"Sample message" isHTML:NO];

    [self presentModalViewController:picker animated:YES];

    [picker release];
} else {
    NSLog(@"cant send mail");
}
A: 

I figured out the problem, but it's absolutely ridiculous -- probably a bug in the SDK. I was presenting the problem UIViewController with a UIModalTransitionStyleFlipHorizontal, while I was presenting the healthy UIViewController with the default transition style. Something about the UIModalTransitionStyleFlipHorizontal seems to make the presented view controller greedy to be first-responder; it won't give up first-responder status to the launched MFMailComposeViewController.

ed94133