Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no need to provide divider images for "11" and "22" states because logically you can't have 2 adjacent selected segments or 2 adjacent highlighted segments. Well, only if tapping adjacent segments simultaneously will highlight them both, but not likely.</p> <p>Therefore you should have following divider images:</p> <pre><code>00, 01, 02 10, --, 12 20, 21, -- </code></pre> <p>In addition, you should also have 3 background images for all 3 different states (Normal, Selected and Highlighted). The reason for these background images as well as how to create them I have explained <a href="http://smnh.me/customizing-appearance-of-uisegmentedcontrol" rel="nofollow noreferrer">here</a> (in that explanation I have used only 2 background images for Normal and Selected states, but if you want to use Highlighted state then you need to add 3rd background image).</p> <p>Here is the diagram that shows how these images are used in UISegmentedControl: <img src="https://i.stack.imgur.com/skn4V.png" alt="enter image description here"></p> <p>And then set them using following appearance methods:</p> <pre><code>// Set background images [segmentedControl setBackgroundImage:background_image_normal forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [segmentedControl setBackgroundImage:background_image_selected forState:UIControlStateSelected barMetrics:UIBarMetricsDefault]; [segmentedControl setBackgroundImage:background_image_highlighted forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; // Set divider images 0=Normal 1=Selected 2=Highlighted [segmentedControl setDividerImage:divider_image_00 forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault] [segmentedControl setDividerImage:divider_image_01 forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault] [segmentedControl setDividerImage:divider_image_10 forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault] [segmentedControl setDividerImage:divider_image_02 forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault] [segmentedControl setDividerImage:divider_image_20 forLeftSegmentState:UIControlStateHighlighted rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault] [segmentedControl setDividerImage:divider_image_12 forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault] [segmentedControl setDividerImage:divider_image_21 forLeftSegmentState:UIControlStateHighlighted rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault] </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload