-
-
Save rolfbjarne/ca32d9a84f9e42f4dc3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Category(typeof(NSLayoutConstraint))] | |
public static class DebugConstraint | |
{ | |
[Export("description")] | |
public static string Description(this NSLayoutConstraint @this) | |
{ | |
// XAMARIN: either of the below two lines causes a stackoverflow, presumably because this method is being invoked instead of the one defined by NSLayoutConstraint | |
//var result = @this.PerformSelector(new Selector("description")); | |
//var originalDescription = @this.Description; | |
objc_super super = new objc_super (); | |
super.receiver = @this.Handle; | |
super.@class = Class.GetHandle (typeof(NSLayoutConstraint).BaseType); | |
var result = Runtime.GetNSObject (objc_msgSendSuper (ref super, Selector.GetHandle ("description"))); | |
Console.WriteLine ("desc: {0}", result); | |
return result.ToString (); | |
} | |
struct objc_super { | |
public IntPtr receiver; | |
public IntPtr @class; | |
} | |
[System.Runtime.InteropServices.DllImport ("libobjc.dylib")] | |
static extern IntPtr objc_msgSendSuper (ref objc_super super, IntPtr sel); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment