Does anyone have any ideas on the right way to do this? There is one answer to a similar question on here, but it's so convoluted, I can't imagine it being right. There has to be an easier way to just show the keyboard when this modal view pops up. right?
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:#"Mail subject"];
[picker setToRecipients:[NSArray arrayWithObjects:#"email#email.com",nil]];
Related
I want to create a simliar effect for ipad in xcode as shown in following link, can any one guide.
http://tutorials.flashmymind.com/2009/04/flash-mouse-trailer-with-stars/
-(IBAction)SendEmail{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:#"Hello from xCode!"];
Regards.
Mouse trails don't even make sense on an iPad. There is no cursor.
I had a tab view controller within which I used to call the code below and it was working fine. I removed the tab and made it a simple navigation controller, but then the same code stopped working. The mail view does not show up. The button action does nothing.
What could be wrong with below code
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController setSubject:[NSString stringWithFormat:#"test"]];
[mailViewController setMessageBody:#"" isHTML:NO];
[mailViewController setToRecipients:[NSArray arrayWithObject:#"test#test.com"]];
[self presentModalViewController:mailViewController animated:YES];
[mailViewController release];}
From your comments above, I'm pretty sure that is your reason. You can't just import the header files to get the MFMailCompose to work. You have to implement the MFMailComposeViewControllerDelegate and the methods that go along with that for it to present the mail view correctly.
Here is a link to a nice tutorial that should help you out getting the methods configured correctly.
In-App Email Tutorial
I am writing an iPad app and want to put an option on the home screen (root view controller) to allow users to e-mail feedback. I would like the mail to appear with the style "UIModalPresentationFormSheet". However, when I run the code, it appears full screen. What am I doing wrong? Here is the code I am using:
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSArray *toAddresses = [[NSArray alloc] initWithObjects:#"user#domain.com", nil];
[picker setToRecipients:toAddresses];
[toAddresses release];
[picker setSubject:#"App Feedback"];
self.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:picker animated:YES];
[picker release];
You must set the style of the viewController being presented, not on the one presenting it.. So set the property of the MFMailComposeViewController and you should be ok.
You need to set modalPresentationStyle on your new view controller, not self.
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");
}
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.
i want to change the navigation bar of MFMailComposeViewController to black color.
how can i change.
Note that MFMailComposeViewController inherits from UINavigationController so it also has navigationBar property.
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.navigationBar.barStyle = UIBarStyleBlack;
I know this post is quite dated but for someone who might find it useful, try:
MFMailComposeViewController *mailController = [MFMailComposeViewController new];
[mailController.navigationBar setTintColor:[UIColor colorWithHue:240.0f/359.0f
saturation:85.0f/100.0f
brightness:60.0f/100.0f
alpha:0.0f]];