UISegmentedControl description is wrong.

  • Am I overlooking it in the doc, or does the doc fail to state that the
    segmented control acts like a radio button?  This appears to be wrong:

    "A UISegmentedControl object is a horizontal control made of multiple
    segments, each segment functioning as a discrete button. A segmented
    control affords a compact means to group together a number of controls."

    This is obviously not true when you press one of the buttons and the
    previously active one is deactivated.  I can't find any way to change this
    behavior.

    The description in Xcode's control gallery is similar.  Is there some way
    to deactivate this behavior?  I find it strange that Apple seems to avoid
    mentioning it on purpose, since it's such a fundamental property of this
    control.

    Thanks for any insight.

    Gavin
  • The documentation does fail to mention the radio button mechanism for the UISegmentedControl, but some books about iOS programming do mention it.

    Too bad you had to find this out on your own, and also sorry to say that you can not change this behavior (except by subclassing the control and managing it yourself, but I would not do it because it is not what users expect).

    Op 25 jun. 2012, om 00:46 heeft Gavin Stokes het volgende geschreven:

    > Am I overlooking it in the doc, or does the doc fail to state that the
    > segmented control acts like a radio button?
    >
    > The description in Xcode's control gallery is similar.  Is there some way
    > to deactivate this behavior?
  • Do you mean that it acts like an individual radio button or a radio button group?

    I think it acts like a group, not a single button.

    On Jun 24, 2012, at 6:46 PM, Gavin Stokes wrote:

    > Am I overlooking it in the doc, or does the doc fail to state that the
    > segmented control acts like a radio button?  This appears to be wrong:
    >
    > "A UISegmentedControl object is a horizontal control made of multiple
    > segments, each segment functioning as a discrete button. A segmented
    > control affords a compact means to group together a number of controls."
    >
    > This is obviously not true when you press one of the buttons and the
    > previously active one is deactivated.  I can't find any way to change this
    > behavior.
    >
    > The description in Xcode's control gallery is similar.  Is there some way
    > to deactivate this behavior?  I find it strange that Apple seems to avoid
    > mentioning it on purpose, since it's such a fundamental property of this
    > control.
    >
    > Thanks for any insight.
    >
    > Gavin
  • Thanks, guys.

    I knew that this is how it usually works, but started wondering because the
    doc seems to go out of its way NOT to mention it.  How can you write
    multiple (wrong) descriptions of this control without noting this
    fundamental aspect of its function?

    Not to mention the poor design of the control itself; it's not at all clear
    which of two buttons is selected, because there's no clear "depressed"
    state depicted.

    elegance++
  • On Jun 24, 2012, at 8:29 PM, Gavin Stokes wrote:

    > I knew that this is how it usually works, but started wondering because the
    > doc seems to go out of its way NOT to mention it.  How can you write
    > multiple (wrong) descriptions of this control without noting this
    > fundamental aspect of its function?

    Uh, guys, you _can_ make segmented controls act as other than radio buttons. It's just that the API for it is on the cell (NSSegmentedCell), not the control. Just change the tracking mode:

        NSSegmentSwitchTrackingSelectOne = 0,  // only one button can be selected
        NSSegmentSwitchTrackingSelectAny = 1,  // any button can be selected
        NSSegmentSwitchTrackingMomentary = 2  // only selected while tracking

    —Jens
  • On Sun, Jun 24, 2012, at 08:38 PM, Jens Alfke wrote:
    >
    > Uh, guys, you _can_ make segmented controls act as other than radio
    > buttons. It's just that the API for it is on the cell (NSSegmentedCell),
    > not the control. Just change the tracking mode:

    UI, not NS.

    --Kyle Sluder
previous month june 2012 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
Go to today