2015 R3 : problem with IOSSegmentedControl

I want to select the value of a segmentedcontrol by code but it does not work anymore. Is it a bug or I am missing someting obvious ?

That code gives me an out of bounds exception:

segmentedcontrol1.value = 3

How many segments do you have? The Value property is 0-based, so that will select the 4th segment. If you don’t have 4 segments, you’ll get an OutOfBoundsException.

Four segments.

What is strange is the fact that this code worked in previous versions.

That is strange. I cannot reproduce it, however. If you have a project that shows this problem, please attach it to a Feedback case so we can look into it.

I can reproduce it right away. Drag a iOSSegmentedControl to a View. Drag a button. Put SegmentedControl1.value = 1 in the Action event.

Boom, out of bounds exception. What’s odd is that I didn’t bump into this during the betas.

Interesting. Just give the iOSSegmentedControl a default Value >= 0 (so something is initially selected) and I think you’ll be ok.

Confirmed, that seems to work around it.

Giles, do you want to get this into Feedback?

Thats ok. I will use the work around. Thanks.