이것은 생각할 줄 모르는 것처럼 보이지만이를 수행 할 방법을 찾을 수 없습니다. 기본적으로 내가 갖고있는 것은 NSLocalizedString
을 사용하는 두 개의 현지화 된 레이블이있는 UISegmentedControl
입니다. 글꼴 크기를 설정했는데 영어와 다른 언어로 된 모든 것이 멋지게 보입니다. 그러나 일본어와 다른 언어에서는 문자가 더 크고 레이블이 잘 리게됩니다.스케일 UISegmentedControl 컨트롤의 너비를 기준으로 한 레이블
self.segmentedControl = [[UISegmentedControl alloc] initWithItems:
[NSArray arrayWithObjects:
NSLocalizedString(@"Miles", nil).uppercaseString,
NSLocalizedString(@"Kilometers", nil).uppercaseString,
nil]];
self.segmentedControl.apportionsSegmentWidthsByContent = YES;
self.segmentedControl.selectedSegmentIndex = self.metric ? 1 : 0;
[self.segmentedControl addTarget:self action:@selector(changeMetric:) forControlEvents:UIControlEventValueChanged];
self.segmentedControl.frame = CGRectMake(8, middleHolder.frame.size.height/2+60, progressWidth, 30);
self.segmentedControl.center = CGPointMake(self.view.center.x, self.segmentedControl.center.y);
[self.segmentedControl setTitleTextAttributes:@{
NSForegroundColorAttributeName: [UIColor whiteColor],
NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:36]
} forState:UIControlStateSelected];
[self.segmentedControl setTitleTextAttributes:@{
NSForegroundColorAttributeName: [[UIColor whiteColor] colorWithAlphaComponent:0.3],
NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:36]
} forState:UIControlStateNormal];
self.segmentedControl.tintColor = [UIColor clearColor];
self.segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[middleHolder addSubview:self.segmentedControl];
라벨 폭에 따라 라벨의 글꼴 크기를 확장 할 수있는 방법이 있습니까? 나는 이것이 정상이 아니란 것을 깨닫는다 UILabel
, 그래서 아무 adjustsFontSizeToFitWidth
재산이 없다.