How to set selected segment index in UISegmentedControl? (iPhone SDK)
Posted
by seanny94
on Stack Overflow
See other posts from Stack Overflow
or by seanny94
Published on 2010-02-10T22:38:17Z
Indexed on
2010/06/09
19:02 UTC
Read the original article
Hit count: 656
iphone-sdk-3.0
Hello all!
I'm trying to avoid an app crash here... I have a button that will remove a segment from a UISegmentedControl. If that button is pressed and the user has the segment to be removed selected, the segment will remove and no selection will be highlighted. However, when another button is pushed that does an action that retrieves the selectedSegmentIndex, the app crashes.
In short: Is there any way to force the selection of a segment in a UISegmentedControl?
edit it seems as though the UISegmentedControl is returning a selectedSegmentIndex of -1 when no segment is selected... let's see what I can do from here.
© Stack Overflow or respective owner