I have stucked in scenario:
look at this picture:

I have soundPlayerVC as childeViewController of pageContentVC.
soundPlayerVC Present mail modalViewController:
- (IBAction)emailStory:(id)sender {
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
Anecdote *anecdote = (Anecdote *)story;
[picker setSubject:anecdote.name];
[picker setMessageBody:[SearchHandler removeMarkupsFromPageText:anecdote.detail] isHTML:NO];
[self.parentViewController presentViewController:picker animated:YES completion:nil];
}
#pragma mark - mail compose delegates
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
[controller dismissViewControllerAnimated:YES completion:nil];
}
but when I tap on backButton, popViewController doesn't work, because navigationController has been emptied!!
HOW THIS HAPPENED? could someone explain?
I found the solution: that was because of I didn't popViewController in the right viewController.
pageContentVCis child ofbookRootVCsobookRootVCis responsible of removingpageContnetVCfrom navigationController Stack.I created a protocol and added a delegate property
pageContnetVCand assignedbookRootVCas delegate ofpageContnetVCbookRootVCimplement the protocol:in
viewDidLoadand finally backButton in
pageContentVCcall its delegate to remove this view from navigationController.thats all!