0

アプリケーションにリモート コントロール機能を追加するまで、画面上のテキスト ボックスをタップすると、キーボードが完全に表示されていました。

リモコンがファーストレスポンダーになりました。これは、アプリケーションの最初のビューコントローラーにあります。次のビューコントローラーにはテキストボックスが含まれています。タップしてキーボードを見たいとき。

応答のすべてのチェーンを維持して、テキスト ボックスをタップしたときにリモート コントローラーが機能し、テキスト ボックス キーボードが適切なタイミングで表示されるようにするにはどうすればよいですか。

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;
            };



        }
4

0 に答える 0