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.