0

I have added the vfr Reader framework into my application, I can view pdfs, but when I want to email a pdf or cancel the email, the modal view will not dismiss. I am using iOS 6 & xcode 4.5. Here is my code so far:

#pragma mark - Reader method

- (IBAction)didViewPdf {

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);

    NSString *myPath = [paths objectAtIndex:0];

    myPath = [myPath stringByAppendingPathComponent:@"karahipi.pdf"];

    ReaderDocument *document = [ReaderDocument withDocumentFilePath:myPath password:nil];

    if (document != nil) {

        readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document];
        readerViewController.delegate = self;
        readerViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
        readerViewController.navigationController.navigationBar.tintColor = [UIColor blackColor];

        readerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        readerViewController.modalPresentationStyle = UIModalPresentationFullScreen;

        [self presentViewController:readerViewController animated:YES completion:nil];

    }

}

#pragma mark - Reader delegate metho

- (void)dismissReaderViewController:(ReaderViewController *)viewController {

    [self dismissModalViewControllerAnimated:YES];
}

I have run the demo in iOS 6 as target it works there.

iDev
  • 23,310
  • 7
  • 60
  • 85
Nolan Ratu
  • 31
  • 3
  • Please format your code properly. Indent it 4 spaces or select it and click the `{}` button above the edit box. – Kevin Dec 03 '12 at 03:35
  • Doesn't that `dismissReaderViewController` attempt to dismiss the parent of `readerViewController` rather than the `ReaderViewController` itself? I'm not sure why you're not just dismissing the reader view controller from itself, and thus eliminating the need for the delegate. Or is the reader view controller trying to dismiss itself and then its parent, too (assuming was that modally presented ... you didn't show us that, nor how you're invoking this delegate method). – Rob Dec 03 '12 at 05:12
  • BTW, `dismissModalViewControllerAnimated` is now deprecated. Probably should use `dismissViewControllerAnimated:completion:` instead (though that's probably not the problem here). – Rob Dec 03 '12 at 05:14

0 Answers0