I'm using a TabBar app with a navigation item that includes a UISegmentedControl
.
I've connected a method when the event "value changed" is caught.
The method always catch 0 as SegmentIndex...
Here's my header file :
#import <UIKit/UIKit.h>
@interface GraphNavController : UINavigationController {
IBOutlet UIImage *image;
CGPoint gestureStartPoint;
UISegmentedControl *segmentedControl;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
-(IBAction) segmentedControlIndexChanged;
-(void)journalier;
-(void)mensuel;
-(void)annuel;
@property (nonatomic, retain) IBOutlet UIImage *image;
@property (nonatomic, retain) IBOutlet UISegmentedControl *segmentedControl;
@end
The method is here :
-(IBAction) segmentedControlIndexChanged{
switch (self.segmentedControl.selectedSegmentIndex) {
case 0:
NSLog(@"1");
break;
case 1:
NSLog(@"2");
break;
case 2:
NSLog(@"3");
break;
default:
break;
}
}
I hope we will find a solution
Thanks a lot