仿头条导航栏,可存储状态
navTabBarController.showArrayButton = YES; // yes为显示 no为隐藏
navTabBarController.unchangedToIndex = 1;// 此值需要比selectedToIndex小
当点击的标题超过整个滚动条中间时便执行滚动
##使用方法 UIViewController *oneViewController = [[UIViewController alloc] init]; oneViewController.title = @"新闻"; oneViewController.view.backgroundColor = [UIColor brownColor];
UIViewController *twoViewController = [[UIViewController alloc] init];
twoViewController.title = @"体育";
twoViewController.view.backgroundColor = [UIColor purpleColor];
ZLTableViewController *threeViewController = [[ZLTableViewController alloc] init];
threeViewController.title = @"图片";
threeViewController.view.backgroundColor = [UIColor orangeColor];
UIViewController *fourViewController = [[UIViewController alloc] init];
fourViewController.title = @"文化";
fourViewController.view.backgroundColor = [UIColor magentaColor];
UIViewController *fiveViewController = [[UIViewController alloc] init];
fiveViewController.title = @"二手车";
fiveViewController.view.backgroundColor = [UIColor yellowColor];
UIViewController *sixViewController = [[UIViewController alloc] init];
sixViewController.title = @"政治";
sixViewController.view.backgroundColor = [UIColor cyanColor];
UIViewController *sevenViewController = [[UIViewController alloc] init];
sevenViewController.title = @"读书";
sevenViewController.view.backgroundColor = [UIColor blueColor];
UIViewController *eightViewController = [[UIViewController alloc] init];
eightViewController.title = @"游戏";
eightViewController.view.backgroundColor = [UIColor greenColor];
UIViewController *ninghtViewController = [[UIViewController alloc] init];
ninghtViewController.title = @"动漫动画";
ninghtViewController.view.backgroundColor = [UIColor redColor];
ZLNavTabBarController *navTabBarController = [[ZLNavTabBarController alloc] init];
navTabBarController.subViewControllers = @[oneViewController, twoViewController, threeViewController, fourViewController, fiveViewController, sixViewController, sevenViewController, eightViewController, ninghtViewController];
navTabBarController.mainViewBounces = YES;
navTabBarController.selectedToIndex = 5;
navTabBarController.unchangedToIndex = 1;
navTabBarController.showArrayButton = NO;
[navTabBarController addParentController:self];
可根据需要创建相应的控制器