Example #1
0
 public bool DetachWithIME()
 {
     if (CanDetachWithIME())
     {
         if (keyboardViewController != null)
         {
             keyboardViewController = null;
         }
     }
     return(true);
 }
Example #2
0
        // Based on MonoGame's Guide implementation for iOS
        private string ShowKeyboardInput(
            string defaultText)
        {
            OnKeyboardWillShow();

            IsVisible = true;
            EventWaitHandle waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);

            keyboardViewController = new KeyboardInputViewController(
                defaultText, gameViewController);

            UIApplication.SharedApplication.InvokeOnMainThread(delegate
            {
                gameViewController.PresentViewController(keyboardViewController, true, null);

                keyboardViewController.View.InputAccepted += (sender, e) =>
                {
                    gameViewController.DismissViewController(true, null);
                    ContentText = keyboardViewController.View.Text;
                    waitHandle.Set();
                    OnKeyboardWillHide();
                };

                keyboardViewController.View.InputCanceled += (sender, e) =>
                {
                    ContentText = null;
                    gameViewController.DismissViewController(true, null);
                    waitHandle.Set();
                    OnKeyboardWillHide();
                };
                OnKeyboardDidShow();
            });
            waitHandle.WaitOne();

            OnReplaceText(new CCIMEKeybardEventArgs(contentText, contentText.Length));
            IsVisible = false;
            return(contentText);
        }