MobileDatePicker with Xojo 2021 R1

Is it just me or does the MobileDateTimePicker look different in the IDE than when running/simulating the app?

This is what it looks like in the IDE (same as previous version with a fixed height):

And this is the looks in the simulator:
Bildschirmfoto 2021-03-31 um 16.42.41

It’s not centered (as in the IDE) and since I can’t change the height in the IDE, there’s lots of space above and below.

Anybody with the same experience?

It looks like Xojo doesnt allow you to set the style property. I dont know if iOSDesignExtensions has anything to do this yet, but you need to set the preferredDatePickerStyle: Apple Developer Documentation

It’s not so much the style, I don’t care which one it is. The problem is that it’s not consistent between the IDE and the simulator.

1 Like

Since Apple made a new design for the DatePicker in iOS 13, it no longer use the old „style“. Xojo draws the iOS controls itself within the IDE. That’s different then the Desktop. Since you can use older iOS versions of the simulator, made me feel they don’t see an urgent update of the IDE drawing of MobileDatePicket.

Not yet, but it will be available in next release.

You can change the DatePicker display style like this:

Public Enum UIDatePickerStyle
automatic = 0
End Enum

Then set the style:

Static sSystemVersion As Double

//Get sSystemVersion only once
If sSystemVersion = 0.0 Then
  Declare Function currentDevice_ Lib "UIKit.framework" selector "currentDevice" (clsRef As ptr) As ptr
  Declare Function systemversion_ Lib "UIKit.framework" selector "systemVersion" (obj_id As ptr) As CFStringRef
  Declare Function NSClassFromString Lib "Foundation" (name As CFStringRef) As Ptr
  Dim device As Ptr = currentDevice_(NSClassFromString("UIDevice"))
  Dim systemVersion As Text = systemversion_(device)
    sSystemVersion = Double.FromText(systemVersion)
  End Try
End If

if sSystemVersion >= 13.4 then
  declare sub preferredDatePickerStyle lib "UIKit.framework" selector "setPreferredDatePickerStyle:" (obj as ptr, mode as UIDatePickerStyle)
  Dim style As UIDatePickerStyle = UIDatePickerStyle.wheels
  preferredDatePickerStyle(DateTimePicker1.Handle, style)
End If