Giter VIP home page Giter VIP logo

estabbarcontroller's Introduction

ESTabBarController

Build Status Pod Platform

ESTabBarController is a custom tab bar controller for iOS. It has a tab indicator that moves animated along the bar when switching between tabs. It also provides the capability of running actions associated with the tab bar buttons.

Compatible with iOS 7.0 and above.

Demo

Installation

Simply add ESTabBarController to your Podfile:

pod 'ESTabBarController'

Usage

Initialization

ESTabBarController is initialized with an array of images that represent icons for the buttons in the tab bar:

ESTabBarController *tabBarController = [[ESTabBarController alloc] initWithTabIcons:@[[UIImage imageNamed:@"firstIcon"],
                                                                                      [UIImage imageNamed:@"secondIcon"],
                                                                                      [UIImage imageNamed:@"thirdIcon"]]];

If the images are all loaded from the main bundle, a convenience initializer can be used:

ESTabBarController *tabBarController = [[ESTabBarController alloc] initWithTabIconNames:@[@"firstIcon", @"secondIcon", @"thirdIcon"]];

View controllers

View controllers are set in the way:

[tabBarController setViewController:myFirstViewController
                            atIndex:0];

[tabBarController setViewController:mySecondViewController
                            atIndex:2];

Note that it is possible to have an index without an associated view controller. This can be useful when having a button that performs an action but does not switch to a view controller.

Actions

ESTabBarController allows performing actions when pressing a button in the tab bar:

[tabBarController setAction:^{
    // Perform an action.
} atIndex:1];

If there is also a controller associated with the index for an action, this is performed immediately after switching to the controller.

Highlighted buttons

ESTabBarController allows having highlighted buttons. These are displayed in a different way, and are useful when trying to give more importance to a view controller or action.

[tabBarController highlightButtonAtIndex:1];

Colors

ESTabBarController provides a way to customize two colors:

  • The color of the selected buttons and the selection indicator:
tabBarController.selectedColor = [UIColor redColor]; // Any color.
  • The background color of the buttons:
tabBarController.buttonBackgroundColor = [UIColor grayColor]; // Any color.

Example

More usage information can be found in the Example project.

License

This library is available under the MIT license.

estabbarcontroller's People

Contributors

ezescaruli avatar

Watchers

James Cloos avatar Justin Marshall avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.