CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | BSD |
ReleasedLast Release | May 2015 |
Maintained by Chakrit Wichian.
A lightweight tab bar controller geared for maximum customizability. It simply handles the job of switching views and leave everything else for you to customize. Supports using a NIB file to create the main view.
loadView
-based mode within a single class.IBAction
hooks or a single super method call.UINavigationController
UINavigationController
in tabs as well by automatically calling popToRootViewController
on multiple tapsCocoaPods: pod 'OZTabBarController', '~> 0.2.0'
Use the initWithViewControllers:
method or use the designated intializer initWithNibName:bundle:viewControllers:
to create a tab view with the specified view controllers and load view form the specified NIB file.
Or just extends the OZTabBarController
class directly and add a NIB file with the same name to your project.
The NIB file should have these connections:
view
property for the view controller.childViewContainer
property should be connected to a UIView
that will be used to place child tab's views.userDidTapTabButton
action should be connected from a UIControl
which should triggers the respective tab displays. Set the tag
property to index of the tab you wish to display after clicking the button (or whatever action you have wired for your control.)Because tab indexes are zero-based and you might need to use view tags for other purposes, OZTabBarController
now supports a tagOffset
property. You can override this property to specify the number the controller should subtracts from the view tag to obtain the tab index.
For example, if you have your tab buttons' tags set to 100, 101, 102, .. you can set tagOffset
to 100 by placing the following override block on your ViewControler.m
file:
- (NSInteger)tagOffset {
return 100;
}
or simply place self.tagOffset = 100
in your subclass's init method.
If you don't use interface builder and just build your views from loadView
just make sure:
initWithNibName:bundle:viewControllers:
childViewContainer
property to a UIView
instance to which the child tab view should be put to display.setSelectedTabIndex
or setSelectedViewControler
to display the tab as needed.If you are using OZTabBarController
inside a UINavigationController
and find that the
view extends underneath the navigation bar, you can override the following method to
prevent this behavior.
- (UIRectEdge)edgesForExtendedLayout {
return UIRectEdgeNone;
}
Or use the respective setter to set the value as early as possible in your view controller lifecycle.
Refer to this SO question for more information.
BSD2 (See LICENSE file for details)