How to add "Done" button to uiDatepicker in xamarin.ios for compact style

123 Views Asked by At

I was trying to add a button manually on the screen after a datepicker is tapped. But no matter what it always gets under the modal or blurred. Is it possible to add this button on top of that modal somehow and then when the button is tapped the modal will be dismissed. Or only the button being top subview(over the modal) would be enough for me to work on. This is my code:

private void DatePickerDateFrom_EditingDidBegin(object sender, EventArgs e)
{
    UIButton button = new UIButton();
    button.Frame = new CGRect(0, 0, 200, 100);
    button.SetTitle("Done", UIControlState.Normal);
    button.BackgroundColor = UIColor.Red;
    Add(button);
    button.Layer.ZPosition = 1000000;
}

This is the result now(the red blurry button which I want to be clear and tappable) enter image description here

0

There are 0 best solutions below