Coder Social home page Coder Social logo

wess / wcstacknavigationcontroller Goto Github PK

View Code? Open in Web Editor NEW
85.0 9.0 14.0 279 KB

A different approach to the stack navigation made popular by Facebook, Path, and so many more. Following more closely to the UINavigationController/UITabController schema.

License: BSD 2-Clause "Simplified" License

Objective-C 100.00%

wcstacknavigationcontroller's Introduction

WCStackNavigationController

A small class that creates a stack view like those seen on Path, Facebook, and more. Closely follows the UINavigationController pattern with push and pop methods.


Why?

There are a lot of really nice stack view controllers out there, but I wanted to create something that was simple to use and gave me the ability to push and pop controllers on the navigation list with no real effort.

Using WCStackNavigationController

There are a couple of ways you can use this controller, you can either extend it, so you can design/layout your own navigation list view (which is a tableView, of course). When extending just make sure to only override UITableView datasource methods, and if you override selectRowAtIndexPath, be sure to call super. The other way (as a simple demo in the app delegate shows) is to just drop it in and start using it.

There is a category that adds to items to UIViewController based objects, UIViewController+WCStackNavigationController, I would throw this in your prefetch so all your view controllers can have the added attributes.

The attributes added are:

  • stackTitle - This is the title you would like to see displayed on the navigation menu.
  • stackIcon - The image you would like to use to display with your stackTitle on the navigation list.

Delegate Methods (All Optional)

// If Yes, when a controller in navigation is selected, the view will slide closed.
- (BOOL)stackControllerWillCloseNavigationWhenSelected;

// The size of the visible view when slide to the right
- (CGFloat)stackControllerSlideOffset;

// Allow for user to swipe the nav open/close
- (BOOL)stackControllerEnableSwipeForNavigation;

// Called before moving to a new view/view controller.
- (void)stackController:(WCStackNavigationController *)stackController willNavigateToViewController:(UIViewController *)viewController;
- (void)stackController:(WCStackNavigationController *)stackController willNavigateFromViewController:(UIViewController *)viewController;

// Called when navgation to the new controller is complete.
- (void)stackController:(WCStackNavigationController *)stackController didNavigateToViewController:(UIViewController *)viewController;
- (void)stackController:(WCStackNavigationController *)stackController didNavigateFromViewController:(UIViewController *)viewController;

Public Methods

// Push a controller on to the stack and display as current view
- (void)pushViewController:(UIViewController *)viewController;

// Remove a controller from the stack, if removing current controller, will move to previous controller
- (void)popViewController:(UIViewController *)viewController;

// Hides Navigation bar
- (void)setNavigationBarHidden:(BOOL)shouldHide;

// Hides Navigation bar with some animation
- (void)setNavigationBarHidden:(BOOL)shouldHide animated:(BOOL)animated;

Customization

If you want to customize the look of your our stack nav controller, you can. If you wish to alter the cells, you just have to extend WCStackNavigationController and simply overwrite:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

Notes:

  • This project uses ARC
  • Initial project with many plans to expand.

To-Dos

  • Ability to not have/not add item to the navigation list
  • Optional Right side menu/nav.

Screenshot:

ScreenShot


As usual, if you have any suggestions, contributions, etc.. Feel free to message me here or hit me up on twitter (@wesscope).

Thanks,

Wess

wcstacknavigationcontroller's People

Contributors

wess avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wcstacknavigationcontroller's Issues

how to integrate this?

Hi,
I want to integrate this after a uiviewcontroller of connectionviewcontroller so how to do it not in the delegate but in the after connectionbutoon push.

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.