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

后端 未结 1 1093
囚心锁ツ
囚心锁ツ 2021-02-06 19:13

I need to add done button on tool bar with UIkeyboard(type) Number Pad, to resign the keyboard while click on done button. I used Input Accessory View but it adds to normal keyb

相关标签:
1条回答
  • 2021-02-06 19:47
        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;
            }
        }
    
    0 讨论(0)
提交回复
热议问题