LFSSegmentedBarController 1.0.12

LFSSegmentedBarController 1.0.12

测试测试过的
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2015年6月

David Cortés 维护。



  • 作者
  • David Cortés

描述

LFSSegmentedBarController 是一个受 Android 标签栏启发的 iOS 全自定义标签栏。它支持在标签上点击手势和标签之间的滚动。

使用方法

LFSSegmentedBarController 受到原生 iOS SDK 中的 UITabBarController 的启发。您可以在下面看到一个使用此控制器的示例。

LFSSegmentedBarController *tabBarController = [[LFSSegmentedBarController alloc] init];

// We setup all the view controller that will be inside our tab bar controller
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:NSStringFromClass([FirstViewController class]) bundle:nil];
LFSSegmentedBarItem *firstBarItem = [[LFSSegmentedBarItem alloc] initWithTitle:NSLocalizedString(@"Tab 1", nil)];
[firstViewController setSegmentedBarItem:firstBarItem];

SecondViewController *secondViewController = [[SecondViewController alloc] initWithNibName:NSStringFromClass([SecondViewController class]) bundle:nil];
LFSSegmentedBarItem *secondBarItem = [[LFSSegmentedBarItem alloc] initWithTitle:NSLocalizedString(@"Tab 2", nil)];
[secondViewController setSegmentedBarItem:secondBarItem];

ThirdViewController *thirdViewController = [[ThirdViewController alloc] initWithNibName:NSStringFromClass([ThirdViewController class]) bundle:nil];
LFSSegmentedBarItem *thirdBarItem = [[LFSSegmentedBarItem alloc] initWithTitle:NSLocalizedString(@"Tab 3", nil)];
[thirdViewController setSegmentedBarItem:thirdBarItem];

// Setting the view controller will configure all the tab bar properties    
[tabBarController setViewControllers:@[firstViewController, secondViewController, thirdViewController]];

[self.window setRootViewController:tabBarController];

自定义

以下是在 LFSSegmentedBarController 中可自定义的字段示例

LFSSegmentedBarController *tabBarController = [[LFSSegmentedBarController alloc] init];


// Font customizations
[tabBarController setFont:[UIFont systemFontOfSize:17.0]];
[tabBarController setSelectedFont:[UIFont boldSystemFontOfSize:17.0]];

// Line colors and heights
[tabBarController.segmentedControl setHighlightLineHeight:3.0f];
[tabBarController.segmentedControl setLineTintColor:[UIColor whiteColor]];
[tabBarController.segmentedControl setSelectedSectionLineTintColor:[UIColor colorWithRed:0.15f green:0.67f blue:0.86f alpha:1]];

// Text colors
[tabBarController.segmentedControl setTextColor:[UIColor colorWithWhite:0.0f alpha:0.9f]];
[tabBarController.segmentedControl setSelectedTextColor:[UIColor colorWithWhite:0.0f alpha:0.9f]];

// Showing or not showing separator line
[tabBarController.segmentedControl setShowFullWithLine:NO];

待办事项

  • 支持横屏模式(目前已仅在横屏模式下工作)