Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
README.md

README.md

id title brief article sdk
735DF15C-218B-EC0F-3663-DCFF372CE93A
Specify Segment Sizes
This recipe shows how to create a UISegmentedControl with different sized segments.

Recipe

To create a UISegementedControl where the segments are different widths:

  • Create and position the control:
var segmentControl = new UISegmentedControl();
segmentControl.Frame = new CGRect(20,20,200,40);
  • Add the segments and select the default:
segmentControl.InsertSegment("Map", 0, false);
segmentControl.InsertSegment("Road", 1, false);
segmentControl.InsertSegment("Satellite", 2, false);
segmentControl.SelectedSegment = 1;
  • Set the sizes for each segment
segmentControl.SetWidth (40f, 0);
segmentControl.SetWidth (80f, 1);
segmentControl.SetWidth (120f, 2);

Additional Information

If the sum of the segment widths is different to the width of the control, the segment widths will override the Frame.Width.