簡體   English   中英

使用Mono Touch的Iphone鍵盤頂部帶有完成按鈕的工具欄?

[英]Tool bar with done button on top of keyboard for Iphone using Mono Touch?

我需要在工具欄上使用UIkeyboard(類型)數字鍵盤添加完成按鈕,以在單擊“完成”按鈕時退出鍵盤。 我使用了Input Accessory View,但它也添加到了普通鍵盤上,我需要在我有數字鍵盤的地方添加它。例如,我有一個文本字段,它只需要數字就可以了,除了我不想顯示的地方輸入附件視圖。否則我需要使用Mono Touch為Iphone顯示帶有完成按鈕的工具欄。

謝謝。

    public override UIView InputAccessoryView
    {
        get
        {
            if (dismiss == null)
            {

                UIToolbar toolbar = new UIToolbar(new RectangleF(0, 0, 320, 30));

                toolbar.BarStyle = UIBarStyle.BlackTranslucent;
                dismiss = new UIView(new RectangleF(-20, -120, 320, 30));
                dismissBtn = new UIButton(new RectangleF(268, 1, 50, 29));
                dismissBtn.SetBackgroundImage(new UIImage("Images/done_active.png"), UIControlState.Normal);

                dismissBtn.AllEvents += delegate
                {
                    HideKeyBoard();
                };

                toolbar.AddSubview(dismissBtn);
                dismiss.AddSubview(toolbar);
                dismiss.BringSubviewToFront(dismissBtn);
                dismiss.BringSubviewToFront(toolbar);

            }
            return dismiss;
        }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM