Мне также никогда не удавалось сделать кнопки меньше, несмотря на попытки каждого сегментированного ControlStyle. Вот код, который мне нужно было использовать, чтобы хотя бы получить правильный оттенок цвета на IOS4:
- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller {
static BOOL tintAlreadyChanged = NO;
if (tintAlreadyChanged) return;
NSLog(@"Searching subViews for UISegmentControl:");
//fix segmented control
for (UIView *subview in self.view.subviews) {
//NSLog(@"\n\nsubView = %@",subview);
for (UIView *subview2 in subview.subviews) {
//NSLog(@"subView2 = %@",subview2);
for (UIView *subview3 in subview2.subviews) {
//NSLog(@"subView3 = %@",subview3);
if ([subview3 isKindOfClass:[UISegmentedControl class]]) {
NSLog(@"Found UISegment SubView = %@",subview3);
UISegmentedControl *segmentedControl = (UISegmentedControl *)subview3;
segmentedControl.tintColor = [UIColor blackColor];
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBezeled;
tintAlreadyChanged = YES;
}
}
}
}
}