.NET MAUI: Inline iOS DatePicker - Stack Overflow

admin2025-05-01  0

I am trying to use the calendar style datepicker in my .NET MAUI iOS app via the handler:

Microsoft.Maui.Handlers.DatePickerHandler.Mapper.AppendToMapping("CalendarPicker", (handler, view) =>
{
    if (handler.PlatformView.InputView is UIDatePicker picker)
    {
        picker.PreferredDatePickerStyle = UIDatePickerStyle.Inline;
    }
});

But as is it looks like this on a physical iPhone (bottom row is cut off and even more is cut off when I rotate to landscape):

and like this on a simulator (looks fine in potrait, but also gets cut off in landscape):

I tried setting picker.TranslatesAutoresizingMaskIntoConstraints to true/false and that did not help. Is this style just broken in MAUI or is there a workaround?

转载请注明原文地址:http://anycun.com/QandA/1746099588a91659.html