당신은 코드 아래 사용할 수 있습니다 :
// Add rounded yellow corner to segmented controll view
[segmentedControl.layer setCornerRadius:4.0f];
[segmentedControl.layer setBorderColor:[UIColor colorWithRed:1.0 green:0.7 blue:0.14 alpha:1.0].CGColor];
[segmentedControl.layer setBorderWidth:1.5f];
[segmentedControl.layer setShadowColor:[UIColor blackColor].CGColor];
[segmentedControl.layer setShadowOpacity:0.8];
[segmentedControl.layer setShadowRadius:3.0];
[segmentedControl.layer setShadowOffset:CGSizeMake(2.0, 2.0)];
:
// To set colour of text
NSDictionary *attributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:UITextAttributeTextColor];
[segmentedControl setTitleTextAttributes:attributes forState:UIControlStateNormal];
NSDictionary *highlightedAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:UITextAttributeTextColor];
[segmentedControl setTitleTextAttributes:highlightedAttributes forState:UIControlStateHighlighted];
// Change color of selected segment
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
UIColor *newTintColor = [UIColor colorWithRed: 255/255.0 green:100/255.0 blue:100/255.0 alpha:1.0];
segmentedControl.tintColor = newTintColor;
UIColor *newSelectedTintColor = [UIColor clearColor];
[[[segmentedControl subviews] objectAtIndex:0] setTintColor:newSelectedTintColor];
을하고 모서리가 둥근 최저치를 위해 당신이 코드 아래 사용할 수 있습니다 여기에
는
UISegmentedControl
당신이 하위 클래스로 할 수있는 방법의 예
이 코드는 테두리 나 반지름을 만들지 않습니다 :/ –
이제 편집을 확인할 수 있습니다 :) – Ashutosh
This doesn iOS 6에서 조정 해본 후에도 작동하지 않습니다. – CVertex