UI键盘没有显示

时间:2013-12-12 06:44:24

标签: ios objective-c xamarin.ios keyboard remote-control

当我点击屏幕上的文本框直到我为我的应用程序添加了遥控功能时,它完美地显示了键盘。

遥控器现在成为第一响应者。它位于应用程序的第一个viewcontroller中。下一个viewcontrollers包含文本框。当我点击并想要看键盘时。

当我点击文本框时,如何保持响应的所有链条以保持遥控器正常工作和文本框键盘正确显示。

WhatToDo.cs包含远程控制处理程序,BrowseApi.cs包含键盘。

WhatToDo.cs

public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            UIApplication.SharedApplication.SetStatusBarHidden (true, UIStatusBarAnimation.Fade);
        -
            if (audioSession == null) {
                audioSession = AVAudioSession.SharedInstance ();
                NSError error;
                audioSession.SetCategory (AVAudioSession.CategoryPlayback, out error);
                audioSession.SetActive (true, out error);

                //AudioSession.Initialize(null, NSRunLoop.NSDefaultRunLoopMode);
                //AudioSession.AudioRouteChanged += AudioSession_AudioRouteChanged;
                AudioSession.Initialize (null, NSRunLoop.NSDefaultRunLoopMode);
                AudioSession.AudioRouteChanged += AudioSession_AudioRouteChanged;
                UIApplication.SharedApplication.BeginReceivingRemoteControlEvents ();
                this.BecomeFirstResponder ();

            }
            // Perform any additional setup after loading the view, typically from a nib.
        }

        public override void ViewDidAppear (bool animated)
        {
            base.ViewDidAppear (animated);


        }

        public override void DidReceiveMemoryWarning ()
        {
            // Releases the view if it doesn't have a superview.
            base.DidReceiveMemoryWarning ();

            // Release any cached data, images, etc that aren't in use.
        }

        public override void ViewDidUnload ()
        {
            base.ViewDidUnload ();

            // Clear any references to subviews of the main view in order to
            // allow the Garbage Collector to collect them sooner.
            //
            // e.g. myOutlet.Dispose (); myOutlet = null;

            ReleaseDesignerOutlets ();
        }

        public override bool CanBecomeFirstResponder {
            get {
                return true;
            }
        }

        public override bool CanResignFirstResponder {
            get {
                return false;
            }
        }

        /// <summary>
        /// Kulaklıkk cıkınca girince buraya ugrar.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void AudioSession_AudioRouteChanged (object sender, AudioSessionRouteChangeEventArgs e)
        {

        }



        public override void RemoteControlReceived (UIEvent theEvent)
        {
}

BrowseApi.cs

public override void ViewDidLoad ()
        {


            textBoxSearchBrowseApi.Text = QueryStr;
            base.ViewDidLoad ();
            this.textBoxSearchBrowseApi.ShouldReturn = delegate(UITextField textField) {
                this.textBoxSearchBrowseApi.BecomeFirstResponder ();
                return true;
            };


            // make 'return' on last text field save and close the form
            this.textBoxSearchBrowseApi.ShouldReturn = delegate(UITextField textField) {
                this.textBoxSearchBrowseApi.ResignFirstResponder ();
                searchQuery(textBoxSearchBrowseApi.Text);
                return true;
            };



        }

0 个答案:

没有答案