remove annotation from another view - 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: remove annotation from another view

remove annotation from another view 2 years 1 month ago #11323

  • Shades
  • Shades's Avatar Topic Author
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 37
  • Thank you received: 0
Hello,

I would like to remove annotation from another view.When I use the NSNotificationCenter,the annotation is not removed.This how it should work:

1- I have a pdf where I draw an annotation
2- I submit the annotation and I navigate to the second view
3- I have a button in the second which remove the annotation without having to go to pdf.

Can you help me please ?

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

remove annotation from another view 2 years 4 weeks ago #11327

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

you can delete an annotation from another view with notification following these steps:
- Create a method that delete an annotation:
- (void)deleteAnnot:(NSNotification *)notification
{
    PDFAnnot *annot = (PDFAnnot *)notification.object;
    [annot removeFromPage];
    [m_view vRenderSync:m_annot_pos.pageno]; //or the specific page
    [self refresh];
}
- Create an observer for example in PDFView class that calls deleteAnnot method:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteAnnot:) name:@"delete-annot" object:nil];
- Post the notification from a different view (for example you can call pushViewController to show the view):
[[NSNotificationCenter defaultCenter] postNotificationName:@"delete-annot" object:_annot];

Pay attention to keep the annotation instance (annot) also in the second view and send it as notification param.
In this case is assumed that the pdf is opened.
The following user(s) said Thank You: Shades

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

  • Page:
  • 1
Powered by Kunena Forum