views:

235

answers:

1

I have a segment control that when one of the segments is clicked I want to pass variables (two integers to be specific) to the segmented control's action. How do I modify the below code to do so? I know how to go to the segment action but I don't know how to pass variables to it. I know this is probably obj-C 101 but I'm stumped. Thanks for your help.

[segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];

.
.
.
// segment action
- (void) segmentAction:(id)sender {

}
+1  A: 

I don't believe there is a way to do it. No method on UIControl takes a UserInfo dictionary or a NSInvocation object. Your best bet will probably just set the values in the action method based on the selectedSegmentIndex.

criscokid