Change height of the UISegmentedControl
UISegmentedControl changing height is sometimes difficult to find. It can be easily done if you are using constraints.
In case if you don't use constraints , I tried the following approach which I though would work, but actually it did not.
- (void)viewDidLoad {
[super viewDidLoad];
CGRect rect=self.seg_cntrl.frame;
rect.size.height=60.0;
[self.mySegmentControl setFrame:rect];
}
- (void)viewDidLoad {
[super viewDidLoad];
UISegmentedControl *seg=[[UISegmentedControl alloc] initWithItems:@[@"1",@"2"]]
;
[seg setFrame:CGRectMake(25.0, 70.0, 300.0, 60.0)];
[self.view addSubview:seg];
}
The result can be seen in the following image.
Comments
Post a Comment