Re: show selected image in a segmented control
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