iOS Guides | Samples

MonoTouch.UIKit.UIApplication.Notifications.ObserveContentSizeCategoryChanged Method

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

Syntax

public static NSObject ObserveContentSizeCategoryChanged (EventHandler<UIContentSizeCategoryChangedEventArgs> 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 NSNotificationCenter.RemoveObserver

Remarks

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

c# Example

//
// Lambda style
//

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

    Console.WriteLine ("WeakNewValue", args.WeakNewValue);
});

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

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

    Console.WriteLine ("WeakNewValue", args.WeakNewValue);
}

void Setup ()
{
    notification = UIApplication.Notifications.ObserveContentSizeCategoryChanged (Callback);
}

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

Requirements

Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0