Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A VERY useful extension method for MonoTouch to dump a view stack to a log or console, you can supply the UIApplication.SharedApplication.KeyWindow even for a full view dump, this is an undocumented iOS selector, but generally used for debugging anyway.
using System;
using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;
using MonoTouch.UIKit;
namespace NS {
public static class UIViewExtensions {
// returns the view and all child views with status
public static string RecursiveDescription(this UIView view)
{
return new NSString(Messaging.IntPtr_objc_msgSend(view.Handle, new Selector("recursiveDescription").Handle)).ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment