close ios done button - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC: close ios done button

close ios done button 3 years 7 months ago #8732

  • yılmaz
  • yılmaz's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 0
I want to close pdf when I clicked "done" button.
- (void)dismissReaderViewController:(RDPDFViewController *)viewController
{
[self dismissViewControllerAnimated:YES completion:NULL];
}

-(void)openPDF:(NSString *)bookId fileName:(NSString *)fileName title:(NSString *)title{
[self loadSettingsWithDefaults];


int result = [m_pdf PDFOpen:pdfFullPath:@"password"];
if(result == 1)
{




int pageno =1;
[m_pdf PDFThumbNailinit:pageno];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissReaderViewController)];
doneButton.title = @"Done";
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:m_pdf];


[navController.navigationBar setBarStyle:UIBarStyleDefault];
m_pdf.navigationItem.leftBarButtonItem=doneButton;

[self presentViewController:navController animated:YES completion:NULL];
}

Please Log in or Create an account to join the conversation.

close ios done button 3 years 7 months ago #8733

  • emanuele
  • emanuele's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 516
  • Karma: 15
  • Thank you received: 56
Hi,

I tried to do the same steps to show show the reader with presentViewController method.
The only thing that you should fix, is the doneButton declaration: @selector(dismissReaderViewController:) instead of @selector(dismissReaderViewController).
The ":" allow to call your method (dismissReaderViewController) correctly.
The following user(s) said Thank You: yılmaz

Please Log in or Create an account to join the conversation.

close ios done button 3 years 7 months ago #8735

  • emanuele
  • emanuele's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 516
  • Karma: 15
  • Thank you received: 56
When vClose method is called, the pdf will be saved if necessary. The vClose method is called in RDPDFViewController, viewWillDisappear method.
If I correctly understood, in your project you can open a pdf file, but you can't close it with your button, right?

Another thing that you should fix is - (void)dismissReaderViewController:(RDPDFViewController *)viewController definition.
if you call that method with the "done" button, it will pass itself as parameter, not RDPDFViewController; so, your method should be:
- (void)dismissReaderViewController
{
....
}
the RDPDFViewController instance is unused in your implementation.
in this way you can restore the previous declaration of the done button (@selector(dismissReaderViewController)) without ":".

Another question: openPDF and dismissReaderViewController methods, are implemented in the same class? If not, you should do it (it could be the most important reason).

Hope it could help

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum