コード例 #1
0
        public void RemoveObjectForKey(string key)
        {
            IntPtr intPtr = ObjC.ToNSString(key);

            ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("removeObjectForKey:"), intPtr);
            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
        }
コード例 #2
0
        public void SetObjectForKey(NSObject obj, string key)
        {
            IntPtr intPtr = ObjC.ToNSString(key);

            ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("setObject:forKey:"), obj.Handle, intPtr);
            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
        }
コード例 #3
0
ファイル: NSDictionary.cs プロジェクト: aws/aws-sdk-unity-net
        public NSObject ObjectForKey(string key)
        {
            IntPtr handle = ObjC.ToNSString(key);
            var    value  = Runtime.GetNSObject <NSObject>(ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("objectForKey:"), handle));

            ObjC.MessageSend(handle, Selector.ReleaseHandle);
            return(value);
        }
コード例 #4
0
        public UIActivityViewController(string text, UIImage image)
        {
            IntPtr textHandle = ObjC.ToNSString(text);
            IntPtr array      = ObjC.ToNSArray(new[] { textHandle, image.Handle });

            ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("initWithActivityItems:applicationActivities:"), array, IntPtr.Zero);
            ObjC.MessageSend(textHandle, Selector.ReleaseHandle);
        }
コード例 #5
0
        public string StringFromNumber(double number)
        {
            IntPtr handle = ObjC.ToNSNumber(number);
            string text   = ObjC.MessageSendString(Handle, Selector.GetHandle("stringFromNumber:"), handle);

            ObjC.MessageSend(handle, Selector.ReleaseHandle);
            return(text);
        }
コード例 #6
0
        public static string LocalizedStringFromNumber(double number, NSNumberFormatterStyle style)
        {
            IntPtr handle = ObjC.ToNSNumber(number);
            string text   = ObjC.MessageSendString(_classHandle, Selector.GetHandle("localizedStringFromNumber:numberStyle:"), handle, (int)style);

            ObjC.MessageSend(handle, Selector.ReleaseHandle);
            return(text);
        }
コード例 #7
0
        public new static NSMutableDictionary FromObjectAndKey(NSObject obj, string key)
        {
            IntPtr intPtr = ObjC.ToNSString(key);
            NSMutableDictionary nSObject = Runtime.GetNSObject <NSMutableDictionary>(ObjC.MessageSendIntPtr(_classHandle, Selector.GetHandle("dictionaryWithObject:forKey:"), obj.Handle, intPtr));

            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
            return(nSObject);
        }
コード例 #8
0
        public string StringFromNumber(double number)
        {
            IntPtr intPtr = ObjC.ToNSNumber(number);
            string result = ObjC.MessageSendString(Handle, Selector.GetHandle("stringFromNumber:"), intPtr);

            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
            return(result);
        }
コード例 #9
0
ファイル: NSDictionary.cs プロジェクト: Bectinced-aeN/vrcsdk
        public NSObject ObjectForKey(string key)
        {
            IntPtr   intPtr   = ObjC.ToNSString(key);
            NSObject nSObject = Runtime.GetNSObject <NSObject>(ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("objectForKey:"), intPtr));

            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
            return(nSObject);
        }
コード例 #10
0
        public NSObject AddObserver(string name, Action <NSNotification> action, NSObject fromObject = null)
        {
            var handler = new Observer(action);

            Callbacks.Subscribe(handler, SelectorName, n => action(Runtime.GetNSObject <NSNotification>(n)));
            ObjC.MessageSend(Handle, Selector.GetHandle("addObserver:selector:name:object:"), handler.Handle, Selector.GetHandle(SelectorName), name, fromObject == null ? IntPtr.Zero : fromObject.Handle);
            return(handler);
        }
コード例 #11
0
ファイル: NSDictionary.cs プロジェクト: aws/aws-sdk-unity-net
        public static NSDictionary FromObjectAndKey(NSObject obj, string key)
        {
            IntPtr handle     = ObjC.ToNSString(key);
            var    dictionary = Runtime.GetNSObject <NSDictionary>(ObjC.MessageSendIntPtr(_classHandle, Selector.GetHandle("dictionaryWithObject:forKey:"), obj.Handle, handle));

            ObjC.MessageSend(handle, Selector.ReleaseHandle);
            return(dictionary);
        }
コード例 #12
0
        public UIActivityViewController(string text)
        {
            IntPtr intPtr = ObjC.ToNSString(text);
            IntPtr arg    = ObjC.ToNSArray(new IntPtr[1]
            {
                intPtr
            });

            ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("initWithActivityItems:applicationActivities:"), arg, IntPtr.Zero);
            ObjC.MessageSend(intPtr, Selector.ReleaseHandle);
        }
コード例 #13
0
        public NSObject AddObserver(string name, Action <NSNotification> action, NSObject fromObject = null)
        {
            Observer observer = new Observer(action);

            Callbacks.Subscribe(observer, "__onNotification:", delegate(IntPtr n)
            {
                action(Runtime.GetNSObject <NSNotification>(n));
            });
            ObjC.MessageSend(Handle, Selector.GetHandle("addObserver:selector:name:object:"), observer.Handle, Selector.GetHandle("__onNotification:"), name, fromObject?.Handle ?? IntPtr.Zero);
            return(observer);
        }
コード例 #14
0
ファイル: NSObject.cs プロジェクト: Bectinced-aeN/vrcsdk
 public virtual void Dispose()
 {
     GC.SuppressFinalize(this);
     if (Handle != IntPtr.Zero)
     {
         Runtime.UnregisterNSObject(Handle);
         Callbacks.UnsubscribeAll(this);
         if (_shouldRelease)
         {
             ObjC.MessageSend(Handle, Selector.ReleaseHandle);
         }
     }
 }
コード例 #15
0
        public static IntPtr ToNSSet(string[] items)
        {
            IntPtr[] strings = new IntPtr[items.Length];
            for (int i = 0; i < items.Length; i++)
            {
                strings[i] = ToNSString(items[i]);
            }

            IntPtr array = ToNSArray(strings);
            IntPtr set   = ObjC.MessageSendIntPtr(GetClass("NSSet"), SetWithArraySelector.Handle, array);

            //Release everything
            for (int i = 0; i < strings.Length; i++)
            {
                ObjC.MessageSend(strings[i], Selector.ReleaseHandle);
            }

            return(set);
        }
コード例 #16
0
 //TODO: need to add the callback instead of using IntPtr.Zero
 public void DismissViewController(bool animated = true)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("dismissViewControllerAnimated:completion:"), animated, IntPtr.Zero);
 }
コード例 #17
0
 //TODO: need to add the callback instead of using IntPtr.Zero
 public void PresentViewController(UIViewController controller, bool animated = true)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("presentViewController:animated:completion:"), controller.Handle, animated, IntPtr.Zero);
 }
コード例 #18
0
 public void LoadView()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("loadView"));
 }
コード例 #19
0
 public SKProductsRequest(params string[] productIds)
 {
     ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("initWithProductIdentifiers:"), ObjC.ToNSSet(productIds));
     ObjC.MessageSend(Handle, Selector.GetHandle("setDelegate:"), Handle);
 }
コード例 #20
0
 public void Cancel()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("cancel"));
 }
コード例 #21
0
ファイル: UIApplication.cs プロジェクト: Bectinced-aeN/vrcsdk
 public void SetStatusBarHidden(bool hidden, bool animated = true)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("setStatusBarHidden:animated:"), hidden, animated);
 }
コード例 #22
0
ファイル: UIApplication.cs プロジェクト: Bectinced-aeN/vrcsdk
 public void CancelAllLocalNotifications()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("cancelAllLocalNotifications"));
 }
コード例 #23
0
ファイル: UIApplication.cs プロジェクト: Bectinced-aeN/vrcsdk
 public void ScheduleLocalNotification(UILocalNotification notification)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("scheduleLocalNotification:"), notification.Handle);
 }
コード例 #24
0
ファイル: UIApplication.cs プロジェクト: Bectinced-aeN/vrcsdk
 public void PresentLocationNotificationNow(UILocalNotification notification)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("presentLocalNotificationNow:"), notification.Handle);
 }
コード例 #25
0
ファイル: UIApplication.cs プロジェクト: Bectinced-aeN/vrcsdk
 public void RegisterUserNotificationSettings(UIUserNotificationSettings notificationSettings)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("registerUserNotificationSettings:"), notificationSettings.Handle);
 }
コード例 #26
0
ファイル: UIApplication.cs プロジェクト: Bectinced-aeN/vrcsdk
 public void UnregisterForRemoteNotifications()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("unregisterForRemoteNotifications"));
 }
コード例 #27
0
ファイル: NSTimeZone.cs プロジェクト: Bectinced-aeN/vrcsdk
 public static void ResetSystemTimeZone()
 {
     ObjC.MessageSend(_classHandle, Selector.GetHandle("resetSystemTimeZone"));
 }
コード例 #28
0
ファイル: UIApplication.cs プロジェクト: Bectinced-aeN/vrcsdk
 public void CancelLocalNotification(UILocalNotification notification)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("cancelLocalNotification:"), notification.Handle);
 }
コード例 #29
0
ファイル: UIApplication.cs プロジェクト: Bectinced-aeN/vrcsdk
 public void RegisterForRemoteNotificationTypes(UIRemoteNotificationType types)
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("registerForRemoteNotificationTypes:"), (int)types);
 }
コード例 #30
0
ファイル: UIDevice.cs プロジェクト: aws/aws-sdk-unity-net
 public void PlayInputClick()
 {
     ObjC.MessageSend(Handle, Selector.GetHandle("playInputClick"));
 }