Git Product home page Git Product logo

mcpanelviewcontroller's Introduction

MCPanelViewController

Drop-in panel control for iOS with blurring background and screen-edge activation gestures.

##Screenshot Screenshot

Using MCPanelViewController

First, setup your view controller to display within the panel view controller, then instantiate MCPanelViewController like this:

UIViewController *controller = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LightPanelViewControllerInNavigationController"];
controller.preferredContentSize = CGSizeMake(440, 0);

MCPanelViewController *panelController = [[MCPanelViewController alloc] initWithRootViewController:controller];

or using the convenience method on UIViewController:

MCPanelViewController *panelController = [controller viewControllerInPanelViewController];

Adjust preferredContentSize to set the desired width of the panel. The height is ignored.

Additionally, configure the panel like this:

panelController.masking = NO;
panelController.backgroundStyle = MCPanelBackgroundStyleTinted;
panelController.tintColor = [UIColor colorWithRed:0.7 green:0.7 blue:1 alpha:1];

You can also use background styles MCPanelBackgroundStyleLight, MCPanelBackgroundStyleExtraLight and MCPanelBackgroundStyleDark to match iOS 7 built-in styles. tintColor property is ignored if style is not MCPanelBackgroundStyleTinted.

To open the panel programatically, such as from a button:

[panelController presentInViewController:self.navigationController withDirection:MCPanelAnimationDirectionRight];

or using the convenience method on UIViewController:

[self.navigationController presentPanelViewController:panelController withDirection:MCPanelAnimationDirectionRight];

You may also use MCPanelAnimationDirectionLeft. Present the controller in a full-screen view controller, such as a top-level navigation controller.

To configure a screen-edge gesture and add it to your top-level view controller:

[self.navigationController.view addGestureRecognizer:[panelController gestureRecognizerForScreenEdgeGestureInViewController:self.navigationController withDirection:MCPanelAnimationDirectionRight]];

License

MCPanelViewController is under the MIT license.

mcpanelviewcontroller's People

Contributors

matthewcheok avatar mmattt avatar

Watchers

Steven Zhang 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.