Skip to content

Instantly share code, notes, and snippets.

@KennyGoers
Created July 21, 2012 15:14
Show Gist options
  • Save KennyGoers/3156085 to your computer and use it in GitHub Desktop.
Save KennyGoers/3156085 to your computer and use it in GitHub Desktop.
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