iOS Question SegmentedControl Color

mrossen

Active Member
Licensed User
Longtime 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

  • segtest.zip
    2 KB · Views: 283
  • 1.png
    1.png
    58.7 KB · Views: 308
  • 2.png
    2.png
    89.7 KB · Views: 303

Mike1970

Well-Known Member
Licensed User
Longtime 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.
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime 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
 
Upvote 0
Top