iOSKit PickerView on Container gives error

If I drag an iOSKit PickerView directly onto a Screen it works fine.

Now I want it to be on a Container so I can attach it to a ScrollableArea, but when dragged onto a Container and compiled, you get the error “Parameter ‘child’ expects class MobileUIControl, but this is class Extensions.PickerView”.

Is there a way to use an iOSKit PickerView on a Container?

Maybe there is some change with API 2.0 where iOSUserControls no longer work in a container? @Greg_O_Lone can the super class of the PickerView be converted to a Mobile variant, or does the class have to be rewritten now?

Not at my desk yet, but I believe there is now an iOSMobilecontrol that is compatible with the new layouts.

The class name is iOSMobileUserControl

1 Like

@Jason_King where do I place this ’ iOSMobileUserControl’ to get the PickerView working on a Container control?

I have tried changing the Super, but it broke other areas.

I’ll be honest I haven’t used API2.0 with iOS. But you should be able to change the super of the PickerView to the new iOSMobileUserControl class instead of iOSUserControl. Do do that find the Extensions module, select the PickerView class, then in the inspector change the super. If that still doesn’t work I’m not sure what might be broken but the fact it works on views and not container controls seems to be a Xojo bug

@Jason_King your suggestion works, thank you!

Adjustments to your iOSKit:

  1. Change the Super for both PickerView and PickerViewMultiline from ‘iOSUserControl’ to ‘iOSMobileUserControl
  2. In both their CreateView EventHandlers change ‘Return UInteger(selfRef)’ to ‘Return Ptr(selfRef)
  3. In the MissingControlsView window move the Open Event commands into a new Opening Event, then delete the old Open Event
  4. Comment out the PickerView2.Invalidate command

Using 2001r2 I can’t get the picker view to show up at all.
Before I spend too much time, has anyone else seen the same issue?

Do you mean 2021R2?

Working for me — BTW it is Invisible by default!

ahhhhhhh invisible!

I have a similar problem and don’t know how to fix it.
I build a container, to hold a number of labels and data entry fields in API 2.0, Xojo 2021 R2
When I try to compile, I get the message:

Parameter “child” expects class MobileUIControl, but this is class iOSLabel.

I have tried changing the Super to iOSMobileUserControl from the default of MobileContainer (Why isn’t this the default display?) and now it can’t cope with an embedded segmented control:

Container1.ACTDeviceSegmentedControl.Pressed Declaration
ACTDeviceSegmentedControl on Container1 implements the event “Pressed”, but its superclass iOSMobileUserControl does not declare such an event.
Sub Pressed(segmentedIndex As Integer)

Any advice would be appreciated. Thank you for the advice to date - it was very helpful

Make sure you are using MobileLabel controls and not iOSLabel

1 Like

Thank you. I will have to go through and check everything, but that answers my question.
Also, let me add to the list of people thanking you for i-Rate code.
I am adding it to the app I managed to get up on the App Store.