I am using a UISegmentedControl with some custom images:
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:nil];
[segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"0.png"] atIndex:0 animated:NO];
[segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"1.png"] atIndex:1 animated:NO];
[segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"2.png"] atIndex:2 animated:NO];
segmentedControl.frame = CGRectMake(0, 0, 90, 30);
[self.view addSubview:segmentedControl];
[segmentedControl release];
This part works fine. But, it still uses Apple's styling for the control and just adds my images over it. Is there a way that I don't have to use Apple's styles, and customize the conrol with my own images with no background? I would also like to have my own "selected" state images.
Possible?
Nic,
After playing with this for a while, I decided to simply "roll my own" in a way.
I made some button images in photoshop and got everything looking like a segmented control. Then, I set a different image for the "selected" states of all the buttons. When one button was pressed, I called setSelected:NO to the others. Then, I handled whatever I needed to do.
I'd love to hear other solutions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With