Code Monkey home page Code Monkey logo

martyjunior's Introduction

MartyJunior

[![CI Status](http://img.shields.io/travis/Taiki Suzuki/MartyJunior.svg?style=flat)](https://travis-ci.org/Taiki Suzuki/MartyJunior) Version License Platform

You can change tab contents with swipe gesture on middle of UITableView!!

Features

  • Change tab middle of UITableView.
  • Be able to scroll smoothly without two step.
  • Auto fill content space when content size is not enough.
  • Flexible and customizable top content.
  • Customizable tab view.
  • Navigation view.

Installation

MartyJunior is available through CocoaPods. To install it, simply add the following line to your Podfile:

  pod "MartyJunior"

Usage

If you install from cocoapods, You have to write import MartyJunior.

Life cycle

viweDidLoad -> viewWillSetupForMartyJunior -> viewDidSetupForMartyJunior

You have to setup delegate, dataSource and so on in viewWillSetupForMartyJunior like this.

override func viewWillSetupForMartyJunior() {
    super.viewWillSetupForMartyJunior()
    delegate = self
    dataSource = self
    registerNibToAllTableViews(ProfileTweetCell.Nib, forCellReuseIdentifier: ProfileTweetCell.ReuseIdentifier)
    registerNibToAllTableViews(ProfileUserCell.Nib, forCellReuseIdentifier: ProfileUserCell.ReuseIdentifier)

    tabView.delegate = self

    title = "@szk-atmosphere"
}

You have to setup NavigationView and so on in viewDidSetupForMartyJunior like this.

override func viewDidSetupForMartyJunior() {
    super.viewDidSetupForMartyJunior()
    navigationView?.titleLabel.alpha = 0
    navigationView?.rightButton = UIButton(type: .InfoDark)
    navigationView?.rightButton?.tintColor = .whiteColor()
}

Specific dataSource methods

// Return number of tabs
func mjViewControllerNumberOfTabs(viewController: MJViewController) -> Int

// Return UIView you want to display as top content
func mjViewControllerContentViewForTop(viewController: MJViewController) -> UIView

// Return TabView if you want to display as custom view
optional func mjViewControllerTabViewForTop(viewController: MJViewController) -> UIView

Other dataSource methods

Protocol based on UITableViewDataSource. It has targetIndex parameter to assign applicable tableView.

  • Example
optional func mjViewController(viewController: MJViewController, targetIndex: Int, numberOfSectionsInTableView tableView: UITableView) -> Int

Specific delegate methods

// Celled when selected tab index was changed
optional func mjViewController(viewController: MJViewController, didChangeSelectedIndex selectedIndex: Int)

Other delegate methods

Protocol based on UITableViewDelegate. It has targetIndex or selectedIndex parameter to assign applicable tableView.

  • Example
optional func mjViewController(viewController: MJViewController, targetIndex: Int, tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
optional func mjViewController(viewController: MJViewController, selectedIndex: Int, scrollViewDidScroll scrollView: UIScrollView)

Requirements

  • Xcode 7 or greater
  • iOS 8.0 or greater
  • MisterFusion (Swift DSL for AutoLayout)
  • UIKit

Other

A sample of this project uses

Author

Taiki Suzuki, [email protected]

License

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

martyjunior's People

Contributors

marty-suzuki avatar

Watchers

Rajesh avatar James Cloos 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.