• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting the Selected Segment of a Segmented Control
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting the Selected Segment of a Segmented Control


  • Subject: Re: Setting the Selected Segment of a Segmented Control
  • From: Daniel Blakemore <email@hidden>
  • Date: Wed, 15 Oct 2014 09:46:40 -0600

I can understand that it might behave that way.  It's not in and of itself
unreasonable, although in my opinion if the selected segment changes
visually, it's kind of weird not to send the message since the key isn't
UIControlEventValueChangedButReallyIOnlyCareAboutWhenTheChangeCameFromATouch.

The irksome thing is that it used to work and now doesn't and there's no
API diff around selectedSegment and the wording in the documentation didn't
change between iOS 7 and 8.

So I don't know if it's an intentional decision or an oversight.


--
Daniel Blakemore
Pixio Software

On Tue, Oct 14, 2014 at 9:20 PM, Richard Charles <email@hidden>
wrote:

> Not sure about iOS but on OS X programmatically calling
>
>     [NSSegmentedControl setSelectedSegment:]
>
> does not trigger the target / action message.
>
> You need to programmatically respond after setting the selected segment.
>
> Richard Charles
>
> On Oct 14, 2014, at 6:55 PM, Daniel Blakemore <email@hidden>
> wrote:
>
> > I have a simple problem.  I am programmatically setting the selected
> > segment of a segmented control.  Then the segmented control is changing
> > which segment appears selected on screen.
> >
> > You might be saying to yourself, "this seems correct".  You would also be
> > correct.
> >
> > What is incorrect is that while the control *appears* to have changed, my
> > code knows nothing of this.
> >
> > I have an action added for the control event UIControlEventValueChanged
> > which is called as expected when you tap the control.
> >
> > HOWEVER, when changing the control programmatically, no such event is
> > generated.  This leaves my app in an inconsistent state.
> >
> > For reference, see this example project
> > https://github.com/danblakemore/SegmentedNope.
> >
> > This worked in iOS 7.  It now does not.  What has changed?
> >
> > --
> > Daniel Blakemore
> > Pixio Software
> > _______________________________________________
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Setting the Selected Segment of a Segmented Control
      • From: Keary Suska <email@hidden>
References: 
 >Setting the Selected Segment of a Segmented Control (From: Daniel Blakemore <email@hidden>)
 >Re: Setting the Selected Segment of a Segmented Control (From: Richard Charles <email@hidden>)

  • Prev by Date: Re: Open document panel always on top - Mountain Lion
  • Next by Date: Re: Setting the Selected Segment of a Segmented Control
  • Previous by thread: Re: Setting the Selected Segment of a Segmented Control
  • Next by thread: Re: Setting the Selected Segment of a Segmented Control
  • Index(es):
    • Date
    • Thread