-1

I have a 3-segment UISegmentedControl as part of a menu that switches between various subscreens. In the main screen, I have a reset button that when touched, empties every field and every text and so on. My problem is that I don't know how to have the highlighted segment in the UISegmentedControl to return to the first segment once the reset button is touched.

How can I program the reset button so that when it is touched, the UISegmentedControl looks like the first segment was touched?

putty174
  • 305
  • 5
  • 19
  • Have you looked at the docs for `UISegmentedControl`? There is a property for setting/getting the segmented control's selected segment. – rmaddy Nov 17 '13 at 06:23
  • Thank you, rmaddy. Another look at the documentation revealed the `selectedSegmentIndex` function, which accomplishes what I wanted. I hooked the reset button with this function to set the selected segment to 0, and now it properly returns the visual selection to the first section. I still need to change the system tracked segment to 0, but I already know how to do that. – putty174 Nov 17 '13 at 06:40
  • Did you follow this http://stackoverflow.com/questions/14494663/change-uisegmentedcontrol-selected-index-or-value-programatically – Hussain Shabbir Nov 17 '13 at 16:27

1 Answers1

-1

Thank you, rmaddy. Another look at the documentation revealed the selectedSegmentIndex function, which accomplishes what I wanted. I hooked the reset button with this function to set the selected segment to 0, and now it properly returns the visual selection to the first section. I still need to change the system tracked segment to 0, but I already know how to do that.

putty174
  • 305
  • 5
  • 19