Convert Figma logo to code with AI

pkluz logoPKRevealController

PKRevealController is a delightful view controller container for iOS, enabling you to present multiple controllers on top of one another.

3,853
659
3,853
93

Top Related Projects

Customizable sliding view controller container.

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !

iOS 7/8 style side menu with parallax effect.

An easy to use floating drawer view controller.

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

A side menu controller written in Swift for iOS

Quick Overview

PKRevealController is an iOS library that provides a slide-out sidebar navigation controller. It allows developers to create a main view with left and/or right side panels that can be revealed by sliding or through programmatic control. This library is designed to be flexible and customizable, making it easy to implement common navigation patterns in iOS applications.

Pros

  • Easy to integrate into existing projects
  • Supports both left and right side panels
  • Highly customizable with various animation options
  • Works well with both portrait and landscape orientations

Cons

  • No longer actively maintained (last update was in 2015)
  • May not be fully compatible with the latest iOS versions
  • Limited documentation and examples
  • Some reported issues with gesture recognizers in complex view hierarchies

Code Examples

  1. Initializing PKRevealController:
UIViewController *frontViewController = [UIViewController new];
UIViewController *leftViewController = [UIViewController new];
UIViewController *rightViewController = [UIViewController new];

PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontViewController
                                                                               leftViewController:leftViewController
                                                                              rightViewController:rightViewController];
  1. Showing the left panel programmatically:
[self.revealController showLeftViewController];
  1. Customizing animation options:
self.revealController.animationDuration = 0.3;
self.revealController.animationCurve = UIViewAnimationCurveEaseInOut;
self.revealController.animationVelocity = 300.0f;
  1. Adding a gesture recognizer to reveal the side panel:
UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.revealController action:@selector(revealPanGestureRecognizer:)];
[self.view addGestureRecognizer:panGestureRecognizer];

Getting Started

  1. Add the PKRevealController files to your project.
  2. Import the header file:
#import "PKRevealController.h"
  1. Initialize the PKRevealController with your view controllers:
UIViewController *frontVC = [UIViewController new];
UIViewController *leftVC = [UIViewController new];
UIViewController *rightVC = [UIViewController new];

PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontVC
                                                                               leftViewController:leftVC
                                                                              rightViewController:rightVC];

self.window.rootViewController = revealController;
  1. Customize the reveal controller as needed:
revealController.animationDuration = 0.25;
revealController.animationCurve = UIViewAnimationCurveEaseInOut;

Competitor Comparisons

Customizable sliding view controller container.

Pros of ECSlidingViewController

  • More customizable with support for various transition styles
  • Better documentation and examples
  • Actively maintained with more recent updates

Cons of ECSlidingViewController

  • Slightly more complex setup process
  • May require more code to implement basic functionality
  • Less intuitive for beginners compared to PKRevealController

Code Comparison

PKRevealController:

PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontViewController leftViewController:leftViewController];
self.window.rootViewController = revealController;

ECSlidingViewController:

ECSlidingViewController *slidingViewController = [ECSlidingViewController slidingWithTopViewController:topViewController];
slidingViewController.underLeftViewController = underLeftViewController;
slidingViewController.underRightViewController = underRightViewController;
self.window.rootViewController = slidingViewController;

Both libraries provide similar functionality for creating sliding menu interfaces in iOS applications. PKRevealController offers a simpler setup process and may be more suitable for beginners or projects with basic requirements. ECSlidingViewController, on the other hand, provides more customization options and is actively maintained, making it a better choice for complex projects or those requiring long-term support.

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !

Pros of SWRevealViewController

  • More actively maintained with recent updates
  • Supports both left and right side reveal
  • Includes gesture recognizers for pan and tap interactions

Cons of SWRevealViewController

  • Slightly more complex setup process
  • Less customization options for animations
  • Requires more code to implement basic functionality

Code Comparison

PKRevealController:

PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontViewController
                                                                               leftViewController:leftViewController];
self.window.rootViewController = revealController;

SWRevealViewController:

SWRevealViewController *revealViewController = [[SWRevealViewController alloc] initWithRearViewController:rearViewController frontViewController:frontViewController];
self.window.rootViewController = revealViewController;
[self.view addGestureRecognizer:revealViewController.panGestureRecognizer];

Both PKRevealController and SWRevealViewController are iOS libraries for implementing a sliding menu interface. PKRevealController offers a simpler setup process and more customization options for animations, while SWRevealViewController provides better support for both left and right side reveals and includes built-in gesture recognizers. SWRevealViewController is more actively maintained, which may be beneficial for long-term project support. The choice between the two depends on specific project requirements and preferences for customization versus ease of implementation.

iOS 7/8 style side menu with parallax effect.

Pros of RESideMenu

  • More customizable appearance with options for background images and blur effects
  • Supports both left and right side menus simultaneously
  • Includes built-in gesture recognizers for easier implementation

Cons of RESideMenu

  • Less flexible in terms of reveal styles (only slide-out menu)
  • May have performance issues with complex view hierarchies
  • Limited animation options compared to PKRevealController

Code Comparison

RESideMenu:

RESideMenu *sideMenu = [[RESideMenu alloc] initWithContentViewController:contentViewController
                                                    leftMenuViewController:leftMenuViewController
                                                   rightMenuViewController:rightMenuViewController];
self.window.rootViewController = sideMenu;

PKRevealController:

PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontViewController
                                                                               leftViewController:leftViewController
                                                                              rightViewController:rightViewController];
self.window.rootViewController = revealController;

Both libraries offer similar initialization methods, but RESideMenu provides more options for customizing the appearance and behavior of the side menu. PKRevealController, on the other hand, offers more flexibility in terms of reveal styles and animations, making it potentially more suitable for complex UI designs.

An easy to use floating drawer view controller.

Pros of JVFloatingDrawer

  • Supports both left and right drawers simultaneously
  • Customizable animation and transition styles
  • Lightweight and easy to integrate

Cons of JVFloatingDrawer

  • Less actively maintained (last update in 2015)
  • Fewer customization options for drawer appearance
  • Limited documentation and examples

Code Comparison

PKRevealController:

PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontViewController
                                                                               leftViewController:leftViewController
                                                                              rightViewController:rightViewController];
[self.window setRootViewController:revealController];

JVFloatingDrawer:

let drawerController = JVFloatingDrawerViewController()
drawerController.leftDrawerViewController = leftViewController
drawerController.rightDrawerViewController = rightViewController
drawerController.centerViewController = centerViewController
self.window?.rootViewController = drawerController

Both libraries provide similar functionality for creating sliding drawer interfaces in iOS applications. PKRevealController offers more extensive customization options and is more actively maintained, while JVFloatingDrawer provides a simpler API and supports simultaneous left and right drawers. The choice between the two depends on specific project requirements and the desired level of customization.

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

Pros of SlideMenuControllerSwift

  • Written in Swift, providing better performance and safety features
  • Supports both left and right side menus
  • Customizable animation and gesture settings

Cons of SlideMenuControllerSwift

  • Less mature project with fewer contributors
  • Limited documentation and examples compared to PKRevealController
  • May require more setup and configuration

Code Comparison

PKRevealController:

PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontViewController
                                                                               leftViewController:leftViewController
                                                                              rightViewController:rightViewController
                                                                                          options:options];

SlideMenuControllerSwift:

let slideMenuController = SlideMenuController(mainViewController: mainViewController, leftMenuViewController: leftViewController, rightMenuViewController: rightViewController)

Both libraries offer similar functionality for creating slide-out menus in iOS applications. PKRevealController is written in Objective-C and has been around longer, providing more stability and extensive documentation. SlideMenuControllerSwift, being written in Swift, offers modern language features and potentially better performance.

The code comparison shows that both libraries have a similar approach to initializing the slide menu controller, with SlideMenuControllerSwift having a slightly more concise syntax due to Swift's language features.

A side menu controller written in Swift for iOS

Pros of SideMenuController

  • More recent and actively maintained (last update in 2022 vs 2015 for PKRevealController)
  • Written in Swift, offering better performance and modern language features
  • Supports both left and right side menus out of the box

Cons of SideMenuController

  • Less customizable in terms of animation and gesture recognition
  • Fewer configuration options for fine-tuning the reveal behavior
  • Smaller community and fewer third-party extensions

Code Comparison

SideMenuController:

let menuController = SideMenuController()
menuController.leftViewController = LeftMenuViewController()
menuController.mainViewController = MainViewController()

PKRevealController:

PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:frontViewController
                                                                               leftViewController:leftViewController
                                                                              rightViewController:rightViewController];

Key Differences

  • SideMenuController uses a more modern, Swift-based approach with simpler setup
  • PKRevealController offers more granular control over reveal behavior and animations
  • SideMenuController has built-in support for both left and right menus, while PKRevealController requires additional configuration for right-side menus

Conclusion

Choose SideMenuController for a modern, Swift-based solution with simpler implementation. Opt for PKRevealController if you need more customization options and don't mind working with Objective-C.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

PKRevealController v2.0

Introducing PKRevealController 2 - The second version of one of the most popular view controller containers for iOS, enabling you to present multiple controllers on top of one another. It is easy to set-up and highly flexible.

Features

  • iPhone and iPad support
  • Landscape and portrait support
  • Left and right side view presentation

##Requirements

  • Requires iOS 6.0 or later
  • Requires Automatic Reference Counting (ARC)

Installation & Usage

If you're using CocoaPods, simply add pod 'PKRevealController' to your Podfile. If you wish to use the static library check out the installation documentation.

Take a look at the usage documentation to find out how easy it is to work with the controller.

Donations & Contact

Keeping this project alive and up to date takes a lot of time. So does responding to all the e-mails I receive. Nevertheless you're free to get in touch with me, be it via twitter @pkluz, mail or issue on GitHub. I'll try to help you as quickly as I can, but I make no promises.

You can support me by donating to my coffee fund! It'll remind me to stay hydrated and keep shipping! :)

Donate

Coverage Status

Consulting

If you need additional support or help integrating and/or customizing the controller for your project, feel free to get in touch (Philip.Kluz@zuui.org).

##License

PKRevealController - Copyright (C) 2012 Philip Kluz (Philip.Kluz@zuui.org)

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.