7 Replies Latest reply: Sep 5, 2008 2:42 PM by Scott Squires1
adrian Roney Level 1 (0 points)

does anyone know how you get touch events from a UISegmentedControl?

I have done this.

UISegmentedControl * mySegmentedControl = [[UISegmentedControl alloc] initWithFrame:ButtonsRect];

mySegmentedControl.momentary = YES;
mySegmentedControl.segmentedControlStyle = UISegmentedControlStyleBordered;

[mySegmentedControl insertSegmentWithTitle:@"some text" atIndex:0 animated:NO];

[mySegmentedControl addTarget:self action:(SEL)@selector(buttonPressed:) forControlEvents:UIControlEventTouchDown];

I have implemented a method called buttonPressed, but it never gets called.

What am I missing?



MacBook, Mac OS X (10.5.2), 2Gb Ram