Forum Xamarin.iOS

Picker with additional text?

ChristianKroesChristianKroes USMember ✭✭✭

Hi guys,

I really would like to show additional text while using the picker, may be left from "done", is that possible? See screenshot

Thank you and best regards


Best Answer


  • ChristianKroesChristianKroes USMember ✭✭✭

    That's it! And so easy ;) Thank you!!!

    Any chance to change the text color of "Fertig" (Done)? And may be add an Cancel Button? Didn't find anything yet :(

    Best regards

  • ChristianKroesChristianKroes USMember ✭✭✭

    I found out to change color of "Done" with view.TintColor ;) But any chance for a cancel button?

  • ColeXColeX Member, Xamarin Team Xamurai

    You could customize everything on the InputAccessoryView , but you should create a new UIView instead .

      if(Control != null)
                UITextField textField = Control;
                //new a UIView
                UIView view = new UIView(frame:new CGRect(0,0,UIScreen.MainScreen.Bounds.Width, 40));
                view.BackgroundColor = UIColor.FromRGB(new nfloat(200), new nfloat(200), new nfloat(200));
                //top border
                CALayer topBorder = CALayer.Create();
                topBorder.Frame = new CGRect(0, 0, view.Frame.Width, 1);
                topBorder.BackgroundColor = UIColor.Gray.CGColor;
                // left label
                UILabel label = new UILabel();
                label.Frame = view.Frame;
                label.Text = "Test";
                //right button
                UIButton button = new UIButton();
                button.Frame = new CGRect(view.Frame.Width -70, 0, 70, 40);
                button.SetTitle("Cancel", UIControlState.Normal);
                button.SetTitleColor(UIColor.Green, UIControlState.Normal);
                button.TouchUpInside += (sender, e1) =>
                textField.InputAccessoryView = view;

Sign In or Register to comment.