ReaderDocument *document = [ReaderDocument withDocumentFilePath:pdfFile password:nil];
ReaderViewController *vc = [[ReaderViewController alloc] initWithReaderDocument:document];
[self.navigationController pushViewController:vc animated:YES];
If I run on iOS7, everything works fine.
If I run my app on iOS8, the willRotateToInterfaceOrientation method in ReaderViewController will never be called, so when the device rotates , The document was not reformatted properly.
However, if I run the demo program that comes with the library on iOS8, the willRotateToInterfaceOrientation in ReaderViewController will be called, which leads me to believe that the library is OK, and I am doing something wrong (or neglecting to do something) in my app.
I am confused about this behavior why it won’t call “RotateToInterfaceOrientation” in my app on iOS8, but What about other variants? How can I try to track this?
My ReaderViewController is being provided from a class that implements viewWillTransitionToSize: withTransitionCoordinator:, so it is not calling the deprecated method on the child view controller.
Neither is called in this implementation
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]
So viewWillTransitionToSize: withTransitionCoordinator: methods of all child view controllers None of them are called.
The fix is to add a call
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]
Enter the parent VC The viewWillTransitionToSize: withTransitionCoordinator: method, subclass ReaderViewController, and then add a viewWillTransitionToSize: withTransitionCoordinator: to my subclass to call the corresponding method in ReaderViewController.
I am in mine The VFR PDF viewer library is used in the application, so I made this point:
ReaderDocument *document = [ReaderDocument withDocumentFilePath:pdfFile password:nil];
ReaderViewController *vc = [[ReaderViewController alloc] initWithReaderDocument:document];
[self .navigationController pushViewController:vc animated:YES];
If I run on iOS7, everything can run normally.
If I run my app on iOS8, in ReaderViewController The willRotateToInterfaceOrientation method is never called, so when the device is rotated, the document is not reformatted properly.
However, if I run the demo program that comes with the library on iOS8, the willRotateToInterfaceOrientation in ReaderViewController will Is called, which leads me to believe that the library is ok, and I am doing something wrong (or neglecting to do something) in my app.
I am confused about this behavior why it won’t work in iOS8 “RotateToInterfaceOrientation” is called in my application above, but what about other variants? How can I try to track this?
I finally managed to solve my problem; what is the problem here, in case anyone else has the same problem.
My ReaderViewController is being provided from a class that implements viewWillTransitionToSize: withTransitionCoordinator:, so the deprecated method on the child view controller is not called.
It is also not called in this implementation
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]
So viewWillTransitionToSize: withTransitionCoordinator: All child view controller methods are not called.
The fix is to add a call
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]
Enter the viewWillTransitionToSize of the parent VC: withTransitionCoordinator: method, subclass ReaderViewController, and then Add a viewWillTransitionToSize: withTransitionCoordinator: to my subclass to call the corresponding method in ReaderViewController.