• Stars
    star
    325
  • Rank 129,350 (Top 3 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 11 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

MCPanelViewController

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

##Screenshot Screenshot

Installation

Add the following to your CocoaPods Podfile

pod 'MCPanelViewController'

or clone as a git submodule,

or just copy files in the MCPanelViewController folder into your project.

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"];

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

or using the convenience method on UIViewController:

MCPanelViewController *panelController = [controller viewControllerInPanelViewController];

Adjust preferredContentSize on your view controller to set the desired width of the panel (default is 320 points). The height is ignored:

controller.preferredContentSize = CGSizeMake(440, 0);

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.

Dismiss from the presented view controller like this:

[self.panelViewController dismiss];

Optional Configuration

Turn off the background masking effect:

panelController.masking = NO;

Turn off pan gesture on the panel:

panelController.panningEnabled = NO;

Adjust background style of the panel:

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.

Screen Edge Gestures

To configure a screen-edge gesture on your top-level view controller, use the following convenience methods on UIViewController:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [self.navigationController addGestureRecognizerToViewForScreenEdgeGestureWithPanelViewController:panelController withDirection:MCPanelAnimationDirectionRight];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];

    [self.navigationController removeGestureRecognizersFromViewForScreenEdgeGestureWithPanelViewController:panelController];
}

License

MCPanelViewController is under the MIT license.

More Repositories

1

POP-MCAnimate

Concise syntax for the Pop animation framework.
Objective-C
951
star
2

Realm-JSON

A concise Mantle-like way of working with Realm and JSON.
Objective-C
663
star
3

JSONCodable

Hassle-free JSON encoding and decoding in Swift
Swift
602
star
4

Fluent

Swift animation made easy
Swift
300
star
5

MCFireworksButton

Drop-in button control with with particle effects similar to the Like button in Facebook Paper.
Objective-C
233
star
6

Kaleidoscope

Writing a lexer and parser for Kaleidoscope in Swift
Swift
61
star
7

MCBlurredModalController

A sleek way to display your view controller modally.
Objective-C
61
star
8

Brotli

An iOS and OSX wrapper for Google's Brotli project.
C
47
star
9

MCNumberLabel

Drop-in label control with the ability to animate digits.
Objective-C
42
star
10

MCGraphView

A light-weight solution for displaying graphs.
Objective-C
19
star
11

MCNotificationManager

Show your own banners like Notification Center within your app.
Objective-C
17
star
12

MCModalView

UIAlertView/UIActionSheet replacement supporting iPhone/iPad and device rotations.
Objective-C
13
star
13

MCAppRouter

URL routing for iOS made simple.
Objective-C
10
star
14

Layout

Functional layout in Swift
Swift
9
star
15

MCBinaryHeap

An Objective-C wrapper of CFBinaryHeap. Core Foundation priority queue implementation.
Objective-C
9
star
16

MCDynamicObject

Automatic persistence for your next iOS project.
C
8
star
17

MCAdditions

A host of useful utilties for any iOS application.
Objective-C
6
star
18

MCObservation

Easy-to-use, fire-and-forget KVO and notifications.
Objective-C
5
star
19

MCTimeSeriesView

A light-weight solution for displaying time series charts.
Objective-C
5
star
20

JSONSerialization

Natively implemented JSON serialization in Swift
Swift
4
star
21

react-rebels

Flux simplified
JavaScript
2
star
22

polymorphism-with-protocols

Good API design is essential for writing code that scales. In this talk, we look at some characteristics of good design and how to refactor code using the protocol features in Swift.
Swift
2
star
23

react-kit

Boilerplate for project with React and Webpack.
JavaScript
2
star
24

amigo

Swift
1
star
25

Click

Easy window recording for macOS
Swift
1
star