//分段控件
导入第三方 LBSegmentControlKit
ViewController.m
#define kScreen_width [UIScreen mainScreen].bounds.size.width
#define kScreen_height [UIScreen mainScreen].bounds.size.height
#import "RViewController.h"
#import "YViewController.h"
#import "KViewController.h"
#import "ZViewController.h"
#import "XViewController.h"
#import "LBSegmentControl.h"
//分段控件直接调用
XViewController* XVC = [[XViewController alloc]init];
ZViewController* ZVC = [[ZViewController alloc]init];
KViewController* KVC = [[KViewController alloc]init];
YViewController* YVC = [[YViewController alloc]init];
RViewController* RVC = [[RViewController alloc]init];
LBSegmentControl * segmentControl = [[LBSegmentControl alloc] initStaticTitlesWithFrame:CGRectMake(0, 20, kScreen_width, 45)];
segmentControl.titles = @[@"想看", @"在看", @"看过",@"影评",@"影人",];
segmentControl.viewControllers = @[XVC,ZVC,KVC,YVC,RVC];
segmentControl.titleNormalColor = [UIColor grayColor];
segmentControl.titleSelectColor = [UIColor blackColor];
[segmentControl setBottomViewColor:[UIColor blackColor]];
segmentControl.isTitleScale = YES;
[self.view addSubview:segmentControl];
网友评论