How do I switch UIsegmentedControl programmatically?

The selectedSegmentIndex property identifies the selected segment of a UISegmentedControl. Set this property to the any valid segment index, or UISegmentedControlNoSegment (-1) to turn off the current selection.

// select the first segment
segmented.selectedSegmentIndex = 0;

// turn off the current selection
segmented.selectedSegmentIndex = UISegmentedControlNoSegment;

Alternatively, after you have changed the selectedSegmentIndex call 'sendActionsForControlEvents:' for example

segmentedControl.selectedSegmentIndex = 0

[segmentedControl sendActionsForControlEvents:UIControlEventValueChanged];

SWIFT 5:

segmentedControl.selectedSegmentIndex = 0
segmentedControl.sendActions(for: .valueChanged)