Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
README.md reorganizing files into recipes folder Mar 7, 2018

README.md

id title brief sdk
13B08892-8DDC-CDDE-63A1-9994E1569249
Configure Segments (UISegmentedControl)
This recipe shows how to create a UISegmentedControl.

Recipe

ℹ️ Note: On iOS 7 and above, the UISegmentedControl styling has been deprecated.

To create a UISegementedControl:

  1. Create and position the control:
var segmentControl = new UISegmentedControl();
segmentControl.Frame = new CGRect(20,20,280,40);
  1. Add the segments and select the default:
segmentControl.InsertSegment("One", 0, false);
segmentControl.InsertSegment("Two", 1, false);
segmentControl.SelectedSegment = 1;
  1. Optionally handle the ValueChanged event:
segmentControl.ValueChanged += (sender, e) => {
    var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment;
    // do something with selectedSegmentId
};

Additional Information

You can create a UISegmentedControl in Xcode by dragging one to the design surface and setting the Segment count and properties in the Attributes Inspector.