Giter Site home page Giter Site logo

apwelsh / slidemenucontrolleroc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pluto-y/slidemenucontrolleroc

0.0 2.0 0.0 1.73 MB

The SlideMenuController is written in Objective-C, which is inspired by the SlideMenuControllerSwift.

License: MIT License

Ruby 0.88% Objective-C 99.12%

slidemenucontrolleroc's Introduction

SlideMenuControllerOC

Platform Language License Issues


This project is inspired by the popular SlideMenuControllerSwift.It provides someone who just developed and someone who needs to support iOS7 even iOS6. And this poroject will be synchronizes with SlideMenuControllerSwift.

iOS Slide View based on iQON, Feedly, Google+, Ameba iPhone app.

sample


##Installation

####CocoaPods

pod 'SlideMenuControllerOC'

####Manually Add the SlideMenuController.h and SlideMenuController.m file to your project.


##Usage

###Setup

Add #import "SlideMenuController.h" in your file

In your app delegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // create viewController code...
        
    SlideMenuController *slideMenuController = [[SlideMenuController alloc] initWithMainViewController:nvc leftMenuViewController:leftViewController rightMenuViewController:rightViewController];
    self.window.rootViewController = slideMenuController;
    [self.window makeKeyWindow];

    return YES;
}

####Storyboard Support

  1. Inherit SlideMenuController and put UIViewController in a storyboard.
  2. Override awakeFromNib, then instantiate any view controllers
@implementation ContainerViewController: SlideMenuController

-(void)awakeFromNib {
    UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Main"];
    if (controller != nil) {
        self.mainViewController = controller;
    }
    UIViewController *leftMenu = [self.storyboard instantiateViewControllerWithIdentifier:@"Left"];
    if (leftMenu != nil) {
        self.leftViewController = controller;
    }
    [super awakeFromNib];
}

@end

If you want to use the custom option, please set them by the instance properties, like so:

Note: This is difference from SlideMenuControllerSwift.

self.slideMenuController.option.leftViewWitdth = 50;
self.slideMenuController.option.contentViewScale = 0.5;
...
    

###You can access from UIViewController

self.slideMenuController

or

SlideMenuController *slideMenuController = self.slideMenuController;
if (slideMenuController != nil) {
    // some code
}

add navigationBarButton

[viewController addLeftBarButtonWithImage:[UIImage imageNamed:@"hoge"]];
[viewController addRightBarButtonWithImage:[UIImage imageNamed:@"hoge"]];

open and close

// Open
[self.slideMenuController openLeft];
[self.slideMenuController openRight];

// close
[self.slideMenuController closeLeft];
[self.slideMenuController closeRight];

You can monitor the menu state by SlideMenuControllerDelegate, something like this

-(void)leftWillOpen;
-(void)leftDidOpen;
-(void)leftWillClose;
-(void)leftDidClose;
-(void)rightWillOpen;
-(void)rightDidOpen;
-(void)rightWillClose;
-(void)rightDidClose;

Requirements

Requires iOS 7.0 and ARC.
If you are developing in the swift and iOS 8.0 and upper, you can use SlideMenuControllerSwift.


Features

  • Highly customizable
  • Complete example

Contributing

Forks, patches and other feedback are welcome.


Creator

SlideMenuControllerOC

Pluto Y - Blog

Sina Weibo

SlideMenuControllerSwift

Yuji Hato

Blog

License

SlideMenuControllerOC 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.