Code Monkey home page Code Monkey logo

dkscrollingtabcontroller's Introduction

DKScrollingTabController

A scrolling tab controller alternative to UISegmentedControl.

Installation

Manual

Add the files in the DKScrollingTabController folder to your project.

Cocoapods

platform :ios, '7.0'
pod 'DKScrollingTabController'

Usage

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Add controller as a child view controller (standard view controller containment)
        DKScrollingTabController *tabController = [[DKScrollingTabController alloc] init];
        [self addChildViewController:tabController];
        [tabController didMoveToParentViewController:self];
        [self.view addSubview:tabController.view];
        
        // Customize the tab controller (more options in DKScrollingTabController.h or check the demo)
        tabController.view.frame = CGRectMake(0, 20, 320, 40);
        tabController.buttonPadding = 23;
        tabController.selection = @[@"zero", @"one", @"two", @"three", @"four",];
        
        // Set the delegate (conforms to DKScrollingTabControllerDelegate)
        tabController.delegate = self;
    }
    return self;
}


#pragma mark - DKScrollingTabControllerDelegate

- (void)DKScrollingTabController:(DKScrollingTabController *)controller selection:(NSUInteger)selection {
    NSLog(@"Selection controller action button with index=%d",selection);
}

Customization

  • Change the controller's padding, font, colors and more.
  • Set layoutIsVertical to YES to show the controller vertically.

Demo

DKScrollingTabController includes a sample project in the Demo folder.

Compatibility

  • This project uses ARC.
  • This project was tested with iOS 7.

Say Hi

License

DKScrollingTabController is available under the MIT license. See the LICENSE file for more info.

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.