iOS Question SegmentedControl Color

mrossen

Active Member
Licensed User
Hi,

When I use segmentedControl and set the color i designer it looks correct, But when I run it there is no colors

I attached a example.

Mogens
 

Attachments

Mike1970

Well-Known Member
Licensed User
Hi,

When I use segmentedControl and set the color i designer it looks correct, But when I run it there is no colors

I attached a example.

Mogens
Hi,

First of all the style of the segmented color in the first picture is the old one (ios12), apple has then changed the design to display it like in the second screenshot you posted (ios13+).

however in the second screenshot you didn't selected none of the two options. Nothing is selected.
With the new segmented you can only change the background color (the one that you have gray), but not the selected color that will always be white.
Or maybe there is a way to change also the selected color, but I think it has to be done in objective C.

I try to modify your example and then I post it.
 

mrossen

Active Member
Licensed User
B4X:
If App.OSVersion >= 13 Then 'you have to change the backgroundcolor, not the tint for the new style
        SegmentedControl1.SetColorAnimated(200, Colors.RGB(Rnd(0,255), Rnd(0,255), Rnd(0,255)))
        
    Else 'works for version under the 13 (i think those has the old style segmented color
        SegmentedControl1.TintColor = Colors.RGB(Rnd(0,255), Rnd(0,255), Rnd(0,255))
    End If
 
Top