一个第三方的分段器 HMSegmentControl
基本的属性和用法:
_contentSwitch = [[HMSegmentedControl alloc] initWithSectionTitles:@[MGJLPLocalizedString(@"lifestyle_publish_what_i_posts", @"关注"),
MGJLPLocalizedString(@"lifestlye_publish_what_i_like", @"发现"),
MGJLPLocalizedString(@"lifestyle_publish_bought", @"我的")]];
_contentSwitch.frame = CGRectMake(0, NAVBAR_HEIGHT, FULL_WIDTH, 55);
_contentSwitch.backgroundColor = [UIColor clearColor];
_contentSwitch.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown;
_contentSwitch.textColor = [UIColor whiteColor];
_contentSwitch.selectionIndicatorColor = MGJ_TextPink;
_contentSwitch.selectedTextColor = MGJ_TextPink;
_contentSwitch.font = FONT(16.f);
_contentSwitch.selectionIndicatorHeight = 1.5f;
[_contentSwitch addTarget:self
action:@selector(contentSwitch:)
forControlEvents:UIControlEventValueChanged];