I have created a segmented controller which has different sized segments.
when i check i see that segment controller has different width-size segments, but when i try to touch the biggest segment it only can be touched on left part of the segment. (probably just first 50 px part, but segment is 160 px). how can i set touchable area of the segment?
//My header file:
#import <UIKit/UIKit.h>
@interface Form1 : UIViewController <UIAlertViewDelegate>{
IBOutlet UISegmentedControl *combobox6001;
}
@property (nonatomic, strong) IBOutlet UISegmentedControl *combobox6001;
@end
#import "Form1.h"
@implementation Form1
@synthesize combobox6001;
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[combobox6001 setWidth:50 forSegmentAtIndex:0];
[combobox6001 setWidth:50 forSegmentAtIndex:1];
[combobox6001 setWidth:160 forSegmentAtIndex:2];
}
I had this same problem myself…it turns out that if you don’t set the width of the segment control itself before setting the width of it’s segments then you get this same problem up here. Here’s an example of what fixed this in my code (hope it helps!):