I have a UISegmentedControl
in my XIB that has four segments. My designer and myself have decided to have certain images for default-state, and other images for the selected-state. Each segment will have different images, for BOTH states. It seems that I can very easily set the image for each segment, but not for each state. How do I set the image for both states for every segment (which is 8 images for 4 segments).
I have thought of one way, but it is not using the UISegmentedControl
itself. I could set the control opacity to 0, have an image with all buttons in default state behind it, and then have four distinct images on top of each segment. When the user selects a segment, the image corresponding to that segment would become visible, and all others would become hidden. It seems I may just have to use this solution, but does anyone know of a simple way using the standard UISegmentedControl
to do what I need?
Thanks
Unfortunately UISegmentedControl
does not support such setup by itself. But you may change the segment images appropriately with the help of setImage:forSegmentAtIndex:
method by yourself each time the user toggles the control
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With