NSLayoutConstraint where is Identifier?

https://developer.apple.com/library/mac/documentation/AppKit/Reference/NSLayoutConstraint_Class/#//apple_ref/occ/instp/NSLayoutConstraint/identifier

The Identifier property is missing. I can set it in IB, but there is no property available from C#.

Xamarin Studio [5.10.3 build 53]
Xamarin.Mac [2.4.2.3]
XCode 7.3.1
OS X 10.11.5

(BTW - Waiting impatiently for this: https://github.com/migueldeicaza/Xamarin.Forms/tree/mac)

Posts

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    Yep. You are completely right. I've filed a bug here: https://bugzilla.xamarin.com/show_bug.cgi?id=41356

    Until then this should help you get by:

    public static class NSLayoutMonkeyPatch
    {
        [DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
        public extern static IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector);
    
        [DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
        public extern static void void_objc_msgSend_IntPtr (IntPtr receiver, IntPtr selector, IntPtr arg1);
    
        public static string GetIdentifier (this NSLayoutConstraint c)
        {
            return (string)NSString.FromHandle (IntPtr_objc_msgSend (c.Handle, ObjCRuntime.Selector.GetHandle ("identifier")));
        }
    
        public static void SetIdentifier (this NSLayoutConstraint c, string id)
        {
            using (NSString s = (NSString)id)
            {
                void_objc_msgSend_IntPtr (c.Handle, ObjCRuntime.Selector.GetHandle ("setIdentifier:"), s.Handle);
            }
        }
    }
    
Sign In or Register to comment.