public void RemoveObjectForKey(string key) { IntPtr intPtr = ObjC.ToNSString(key); ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("removeObjectForKey:"), intPtr); ObjC.MessageSend(intPtr, Selector.ReleaseHandle); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
public virtual void Dispose() { GC.SuppressFinalize(this); if (Handle != IntPtr.Zero) { Runtime.UnregisterNSObject(Handle); Callbacks.UnsubscribeAll(this); if (_shouldRelease) { ObjC.MessageSend(Handle, Selector.ReleaseHandle); } } }
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); }
//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); }
//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); }
public void LoadView() { ObjC.MessageSend(Handle, Selector.GetHandle("loadView")); }
public SKProductsRequest(params string[] productIds) { ObjC.MessageSendIntPtr(Handle, Selector.GetHandle("initWithProductIdentifiers:"), ObjC.ToNSSet(productIds)); ObjC.MessageSend(Handle, Selector.GetHandle("setDelegate:"), Handle); }
public void Cancel() { ObjC.MessageSend(Handle, Selector.GetHandle("cancel")); }
public void SetStatusBarHidden(bool hidden, bool animated = true) { ObjC.MessageSend(Handle, Selector.GetHandle("setStatusBarHidden:animated:"), hidden, animated); }
public void CancelAllLocalNotifications() { ObjC.MessageSend(Handle, Selector.GetHandle("cancelAllLocalNotifications")); }
public void ScheduleLocalNotification(UILocalNotification notification) { ObjC.MessageSend(Handle, Selector.GetHandle("scheduleLocalNotification:"), notification.Handle); }
public void PresentLocationNotificationNow(UILocalNotification notification) { ObjC.MessageSend(Handle, Selector.GetHandle("presentLocalNotificationNow:"), notification.Handle); }
public void RegisterUserNotificationSettings(UIUserNotificationSettings notificationSettings) { ObjC.MessageSend(Handle, Selector.GetHandle("registerUserNotificationSettings:"), notificationSettings.Handle); }
public void UnregisterForRemoteNotifications() { ObjC.MessageSend(Handle, Selector.GetHandle("unregisterForRemoteNotifications")); }
public static void ResetSystemTimeZone() { ObjC.MessageSend(_classHandle, Selector.GetHandle("resetSystemTimeZone")); }
public void CancelLocalNotification(UILocalNotification notification) { ObjC.MessageSend(Handle, Selector.GetHandle("cancelLocalNotification:"), notification.Handle); }
public void RegisterForRemoteNotificationTypes(UIRemoteNotificationType types) { ObjC.MessageSend(Handle, Selector.GetHandle("registerForRemoteNotificationTypes:"), (int)types); }
public void PlayInputClick() { ObjC.MessageSend(Handle, Selector.GetHandle("playInputClick")); }