• 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: show selected image in a segmented control
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: show selected image in a segmented control


  • Subject: Re: show selected image in a segmented control
  • From: Sandro Noël <email@hidden>
  • Date: Thu, 26 Nov 2009 17:14:50 -0500

On 2009-11-26, at 2:04 PM, Pierre Berloquin wrote:

> Hi
>
> I'm using a segmented control with four segments.
> I initialise it with four images.
> It does display the images perfectly but ... it doesn't show which image is
> selected.
> How can I highlight the selected segment/image?
> Should I provide two images for each segment? But how?
>
> Thanks
> Pierre

I would use a different image for every state.
in your action handler

- (IBAction)segControlClicked:(id)sender
{
	int clickedSegment = [sender selectedSegment];
	int clickedSegmentTag = [[sender cell] tagForSegment:clickedSegment];
	// replace your image here
	[segControl setImage:[your image] forSegment:clickedSegment];
	// do not forget to manage the images of the not clicked segments back to original.
}

regards.
Sandro Noel.

_______________________________________________

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

References: 
 >show selected image in a segmented control (From: Pierre Berloquin <email@hidden>)

  • Prev by Date: Re: UIImageView Animation Question
  • Next by Date: Re: Custom Controls Where to start
  • Previous by thread: show selected image in a segmented control
  • Next by thread: Re: show selected image in a segmented control
  • Index(es):
    • Date
    • Thread