tags:

views:

435

answers:

1

I need help with the segmented control. I have put it in my window, and when I test run it, it is clickable. The only problem is I don't know how or where to code it so it works.

+1  A: 

If you want to fire an action on new segment click, override -(void)segmentAction:sender:

- (void)segmentAction:(id)sender {
    NSLog(@"Segment %d selected", [sender selectedSegmentIndex]);
}

Can you be a little more specific what do you want to do?

Dimitar Dimitrov
yeah, sorry. Right now I have a utility page with an info button. On the main screen, I want to have a segment control so the main screen can be split up to about 3 screens, but still have that info button. Also, can you tell me not just the code, but where it goes? Thanks
Aidan
To be honest, I didn't understand what you are trying to do. UISegmentedControl, as I see it, is a horizontal container for segments that function as buttons, and I get the impression you want to use it for something else. As where the code goes, you must have UIViewController for your utility page or your segment control, I would suggest that you put the controlling code there. For example, see the tutorial UICatalog project in the ADC's iPhone section.
Dimitar Dimitrov
Isn't the Segment Control meant for being able to have like two different pages in one?
Aidan
perhaps you're thinking of a Tab Bar?
David Maymudes
I don't know maybe. Here Ill show you what I'm thinking of. Download a free app called BioMetricks Lite and press the info button. On the bottom of that page there is a bar that says Full Version, About, and Help. This is exactly what I want.
Aidan