In my rootViewController , on click of a button I add a childViewController called shareViewController this way
[self addChildViewController:m_shareViewController];
[[self view] addSubview:[m_shareViewController view]];
[[[[UIApplication sharedApplication] delegate] window] addSubview:m_shareViewController.view];
[m_shareViewController didMoveToParentViewController:self];
I use animations to show this view appear from bottom till mid of the screen
This shareViewController has option called email, So in myShareViewController.m I have written this
- (IBAction)email:(id)sender
{
MFMailComposeViewController *emailDialog = [[MFMailComposeViewController alloc] init];
[emailDialog setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail])
{
[self presentModalViewController:composer animated:YES];
}
else
{
return;
}
}
//function to handle errors while sending an email
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
if (error)
{
[self dismissViewControllerAnimated:YES completion:NULL];
}
else
{
[self dismissViewControllerAnimated:YES completion:NULL];
}
}
So the problem which I am facing is that the emailCompose ViewController is presented behind my ShareViewController and is dimmed out. I know why this is happening, because I am using "self" to present the emailComposeVC.
But what I want is that the ShareViewController should present it.And it should be on top of ShareViewController.
Anyideas appreciated.
Regards Ranjit.