Skip to content

MWFSlideNavigationViewController is a container view controller that manages primary and secondary view controller. Primary view controller is the root view controller initialized with the controller. While the secondary controller's view is 'hidden' beneath the primary/root, It's revealed by sliding the primary/root view in one of the 4 directi…

Notifications You must be signed in to change notification settings

bagusflyer/MWFSlideNavigationViewController

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About MWFSlideNavigationViewController

MWFSlideNavigationViewController is a container view controller that manages primary and secondary view controller. Primary view controller is the root view controller initialized with the controller. While the secondary controller's view is 'hidden' beneath the primary/root, It's revealed by sliding the primary/root view in one of the 4 directions supported (up, left, down, right).

It works similar to the Facebook iPhone app, a menu view is revealed when user taps on the menu button. Or in the Piggie app, shortcut buttons view is revealed when user taps the lightning button.


Licensing

MWFSlideNavigationViewController is licensed under MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


How to use

Read the blog post for quick overview. Sample codes are provided in the Demo folder inside the project.

Basic Usage

  • Initialize the controller with your root controller.

    MWFSlideNavigationViewController * ctl = [[MWFSlideNavigationViewController alloc] initWithRootViewController:yourRootViewController];`
  • Assign delegate and dataSource

    // in your root view controller
    - (void) viewDidLoad 
    {
       [super viewDidLoad];
       self.slideNavigationViewController.delegate = self;
       self.slideNavigationViewController.dataSource = self;
    }
  • Trigger the slide animation, e.g. revealing menu on the left (will perform slide animation with right direction)

    // your action method, e.g. in your root view controller
    - (IBAction) showMenu:(id)sender
    {
       [self.slideNavigationViewController slideWithDirection:MWFSlideDirectionRight];
    }
  • Slide the primary/root view back to conceal the secondary view.

    // your action method, e.g. in your root view controller
    - (IBAction) closeMenu:(id)sender
    {
       [self.slideNavigationViewController slideWithDirection:MWFSlideDirectionNone];
    }
  • Implementing Delegate

    - (NSInteger) slideNavigationViewController:(MWFSlideNavigationViewController *)controller 
                       distanceForSlideDirecton:(MWFSlideDirection)direction 
                            portraitOrientation:(BOOL)portraitOrientation
    {
      if (portraitOrientation)
      {
         return 180;
      }
      else
      {
         return 100;
      }
    }
  • Implementing DataSource

    - (UIViewController *) slideNavigationViewController:(MWFSlideNavigationViewController *)controller 
                          viewControllerForSlideDirecton:(MWFSlideDirection)direction
    {
       YourMenuViewController * menuCtl = ...; // alloc and init your controller
       return menuCtl;
    }
  • Enable sliding with pan/swipe gesture

       slideNavigationController.panEnabled = YES;

Documentation

Reference Documentation


AppleDoc Licensing

appledoc is licensed with modified BSD license. In plain language: you're allowed to do whatever you wish with the code, modify, redistribute, embed in your products (free or commercial), but you must include copyright, terms of usage and disclaimer as stated in the license, the same way as any other BSD licensed code. You can of course use documentation generated by appledoc for your products (free or commercial), but you must attribute appledoc either in documentation itself or other appropriate place such as your website.

If for whatever reason you cannot agree to these terms, contact us through contact form on our about page, we'll do our best to help you out you out and find a workable solution!

Copyright (c) 2009-2011, Gentle Bytes All rights reserved.

Redistribution and use in source, binary forms and generated documentation, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Redistributions of documentation generated by appledoc must include attribution to appledoc, either in documentation itself or other appropriate media.

Neither the name of the appledoc, Gentle Bytes nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Gentle Bytes [email protected]

About

MWFSlideNavigationViewController is a container view controller that manages primary and secondary view controller. Primary view controller is the root view controller initialized with the controller. While the secondary controller's view is 'hidden' beneath the primary/root, It's revealed by sliding the primary/root view in one of the 4 directi…

Resources

Stars

Watchers

Forks

Packages

No packages published