Change UISegmentedControl selected index or value programmatically
I have a UISegmentedControl with two segments (index: 0 and 1) that I am trying to reset programmatically to 0. When I run the command below it does not reset the segment index to 0 as expected. Instead it highlights segment indexed 1. [seg setSelectedSegmentIndex:0]; Oddly when I log the selected segment, it returns 0 . NSLog(@"seg setSelectedSegmentIndex %d", seg.selectedSegmentIndex); Also oddly, after running setSelectedSegmentIndex:0 I cannot reselect segment 0 manually by touch, it seems to be locked to segment 1, until I tap 1 wherein it works as normal. Here is the setup for the button