Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

close ios done button 9 years 1 month ago #8732

  • yılmaz
  • yılmaz's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • 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 9 years 1 month ago #8733

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
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 9 years 1 month ago #8735

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
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