Mac Guides | Samples

MonoMac.PdfKit.PdfView.Notifications.ObserveAnnotationWillHit Method

Registers a method to be notified when the PDFViewAnnotationWillHitNotification notification is posted.

Syntax

public static NSObject ObserveAnnotationWillHit (EventHandler<MonoMac.Foundation.NSNotificationEventArgs> handler)

Parameters

handler
Method to invoke when the notification is posted.

Returns

The returned NSObject represents the registered notification. Either call Dispose on the object to stop receiving notifications, or pass it to NSNotification.RemoveObserver

Remarks

The following example shows how you can use this method in your code

c# Example

//
// Lambda style
//

// listening
notification = PdfView.Notifications.ObserveObserveAnnotationWillHit ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);
});

// To stop listening:
notification.Dispose ();

//
//Method style
//
NSObject notification;
void Callback (object sender, ObserveAnnotationWillHit args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);
}

void Setup ()
{
    notification = PdfView.Notifications.ObserveObserveAnnotationWillHit (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

Requirements

Namespace: MonoMac.PdfKit
Assembly: XamMac (in XamMac.dll)
Assembly Versions: 0.0.0.0