Example #1
0
        public static void ReleaseNSArrayItems(IntPtr handle)
        {
            uint   count = ObjC.MessageSendUInt(handle, "count");
            IntPtr obj;

            for (uint num = 0; num < count; num += 1)
            {
                obj = ObjC.MessageSendIntPtr(handle, "objectAtIndex:", num);
                MessageSend(obj, "release");
            }
        }
Example #2
0
        public static T[] FromNSArray <T>(IntPtr handle) where T : NSObject
        {
            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            uint count = ObjC.MessageSendUInt(handle, "count");

            T[]    array = new T[count];
            IntPtr obj;

            for (uint num = 0; num < count; num += 1)
            {
                obj             = ObjC.MessageSendIntPtr(handle, "objectAtIndex:", num);
                array[(int)num] = Runtime.GetNSObject <T>(obj);
            }
            return(array);
        }
Example #3
0
        public static string[] FromNSArray(IntPtr handle)
        {
            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            uint count = ObjC.MessageSendUInt(handle, "count");

            string[] array = new string[count];
            IntPtr   obj;

            for (uint num = 0; num < count; num += 1)
            {
                obj             = ObjC.MessageSendIntPtr(handle, "objectAtIndex:", num);
                array[(int)num] = FromNSString(obj);
            }
            return(array);
        }