0

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.

Zalykr
  • 1,524
  • 1
  • 10
  • 20
Ranjit
  • 4,576
  • 11
  • 62
  • 121
  • Did you try to dismiss your `ShareViewController` before you present the email compose viewController ? – Priyatham51 Oct 22 '13 at 15:25
  • yes , if I do that it will not open the emailVC. – Ranjit Oct 22 '13 at 15:27
  • 1
    try using [self presentViewController] instead of the modalview . If that doesnt help, you can do a achieve this by sending notification to your rootVC. Which will disms your shareVC and present emailVC. – Priyatham51 Oct 22 '13 at 16:21

1 Answers1

0

try using [self presentViewController] instead of the modalview . If that doesnt help, you can achieve this by sending notification to your rootVC. Which will disms your shareVC and present emailVC. –

Priyatham51
  • 1,864
  • 1
  • 16
  • 24