• Stars
    star
    1,178
  • Rank 39,705 (Top 0.8 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 13 years ago
  • Updated over 10 years ago

Reviews

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

Repository Details

(demo) A carefully implemented iOS objective-c library to mimic the sidebar layout of the new Facebook app and Path 2.0 app.

JTRevealSidebarV2 (discontinued)

Updated (20 June 2014)

Apple explicitly discourage the "Hamburger Menu". Watch WWDC 2014 - 211 Designing User Intuitive User Experience.

Apple isn't encouraging the sidebar pattern, we can see that throughout all the official updated on iOS 7, they can potentially put it in the Mail app, the AppStore app, but it never gets actually adopted.

So it's better for me to make this explicitly discontinued than leaving it open. If you're not convinced, at the mean time you may want to use other libraries like ViewDeck, PKRevealController, or browse the bit.ly bundle.

Cheers,
James


An iOS objective-c library template for mimic the sidebar layout of the new Facebook app and the Path app.
JTRevealSidebarV2 is aimed to be a truly flexible and reusable solution for this which has been carefully implemented.

It has been developed under iOS 4.3 and 5.0 devices, sample code has been built using ARC, but the library itself should be both ARC and non-ARC compatible.

Demo

Initialized Left Revealed Left Selected Right Revealed New Pushed New Right Revealed

Abstract

In JTRevealSidebarV2, all sidebars should be considered as navigation items, each sidebar is expected to be able to configure directly through the current view controller.
It is designed to be used with UINavigationController, but technically it should work on other subclasses of UIViewControllers.

How To Use It

Installation

Method 1: Include all header and implementation files in JTRevealSidebarV2/ into your project.

Method 2: Using CocoaPods.

Method 3: (Thanks for gpascale) Include as static library into your project. View the instructions

Setting up your first sidebar, configure your viewController and conform to the JTRevealSidebarV2Delegate

@interface ViewController () <JTRevealSidebarV2Delegate>
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.navigationItem.revealSidebarDelegate = self;
}
/*
:
:
*/
#pragma mark JTRevealSidebarDelegate

// This is an examle to configure your sidebar view through a custom UIViewController
- (UIView *)viewForLeftSidebar {
    // Use applicationViewFrame to get the correctly calculated view's frame
    // for use as a reference to our sidebar's view 
    CGRect viewFrame = self.navigationController.applicationViewFrame;
    UITableViewController *controller = self.leftSidebarViewController;
    if ( ! controller) {
        self.leftSidebarViewController = [[SidebarViewController alloc] init];
        self.leftSidebarViewController.sidebarDelegate = self;
        controller = self.leftSidebarViewController;
        controller.title = @"LeftSidebarViewController";
    }
    controller.view.frame = CGRectMake(0, viewFrame.origin.y, 270, viewFrame.size.height);
    controller.view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;
    return controller.view;
}

// This is an examle to configure your sidebar view without a UIViewController
- (UIView *)viewForRightSidebar {
    // Use applicationViewFrame to get the correctly calculated view's frame
    // for use as a reference to our sidebar's view 
    CGRect viewFrame = self.navigationController.applicationViewFrame;
    UITableView *view = self.rightSidebarView;
    if ( ! view) {
        view = self.rightSidebarView = [[UITableView alloc] initWithFrame:CGRectZero];
        view.dataSource = self;
        view.delegate   = self;
    }
    view.frame = CGRectMake(self.navigationController.view.frame.size.width - 270, viewFrame.origin.y, 270, viewFrame.size.height);
    view.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
    return view;
}

// Optional delegate methods for additional configuration after reveal state changed
- (void)didChangeRevealedStateForViewController:(UIViewController *)viewController {
    // Example to disable userInteraction on content view while sidebar is revealing
    if (viewController.revealedState == JTRevealedStateNo) {
        self.view.userInteractionEnabled = YES;
    } else {
        self.view.userInteractionEnabled = NO;
    }
}

Interacting and revealing your sidebar

@implementation ViewController
/*
:
:
*/
#pragma mark Action

- (void)revealLeftSidebar:(id)sender {
    [self.navigationController toggleRevealState:JTRevealedStateLeft];
}

- (void)revealRightSidebar:(id)sender {
    [self.navigationController toggleRevealState:JTRevealedStateRight];
}

@end

Known Issues

Orientation changing is not an officially completed feature, the main thing to fix is the rotation animation and the necessarity of the container created in AppDelegate. Please let me know if you've got any elegant solution and send me a pull request!
Go to JTRevealSidebarV2/ViewController.h and change EXPERIEMENTAL_ORIENTATION_SUPPORT to 1 for testing purpose.

29/3/2012 updated: Added handy method for toggling reveal state, also added example to disable user interaction while sidebar is revealing

31/1/2012 updated:
Improved orientation support with a better animation, now you needed to #import <QuartzCore/QuartzCore.h> in your project for this sake

1/2/2012 update: Fixed #6 Wrong origin for sidebar views when first revealed in landscape mode (Experiental), the orientation support should be ready!

Reminder

Remember to check out the sample working code in JTRevealSidebarDemoV2/ViewController.m, feel free to provide feedback and pull requests. Thanks!

James

Bitdeli Badge

More Repositories

1

JTGestureBasedTableViewDemo

(demo) Recreating the buttonless interaction pattern found in Clear for iPhone app
Objective-C
1,332
star
2

JTObjectMapping

A very simple objective-c framework that maps a JSON response from NSDictionary or NSArray to an NSObject subclass for iOS.
Objective-C
263
star
3

CRDT

CRDT implementation in Swift, Last Write Win
Swift
42
star
4

AFNetworking-ProxyQueue

AFNetworking with multiple operation queue support, to separate download operations from affecting too much on main network request.
Objective-C
40
star
5

JTAttributedLabel

Ported back NSAttributeString in iOS 5 for you to create rich text UILabels in Interface Builder. (experimental)
Objective-C
38
star
6

MVCP

Introducing Model-View-Controller-Presenter
Objective-C
31
star
7

ObjectiveSpring

A sample project for using Spring in Objective-C project
Swift
28
star
8

SettingsBundleDemo

Integrate Settings.bundle and show iOS version with Git commit in 5 mins
Objective-C
25
star
9

JTPinIt

An incomplete project which aimed to provide share to Pinterest without going through that in-app camera which crops your image
Objective-C
13
star
10

JTImageKit

Simple cocoa library to provide convenience image manipulation for iOS
Objective-C
7
star
11

Today-PressKit

Press Kit for Today iOS app
5
star
12

Today-web

Landing Page for Today iOS App
CSS
3
star
13

JTImageProxyDemo

Objective-C
3
star
14

JTJSON

Just an experimental project of finding out the possibilities to get a JSON response to be translated to a plist format. Do we really need a 3rd party string parsing based JSON library?
Objective-C
3
star
15

ga-bridge

Use Google Analytics without SDK (and for your OSX application)
Objective-C
2
star
16

mystcolor.github.com

Ruby
2
star
17

XcodeProjectTemplateForSketchPlugin

Too bad, don't use.
Objective-C
2
star
18

JTOperationWallet

An objective-c NSProxy based library for simulating what blocks are convenience for, an iOS 3 compatible alternative solution to blocks.
Objective-C
2
star
19

OpenRxSwift

WIP
Swift
1
star
20

jamztang.github.io

JavaScript
1
star
21

CropTool

Swift
1
star
22

ioscodesnippet

1
star
23

testTrackpadGesture

Swift
1
star
24

testHoverButton

ToolTip implementation for Catalyst
Swift
1
star
25

DynamicNavigation

Swift
1
star
26

IntentionKit

Solely experiment and not under active development
Objective-C
1
star
27

prototype

Presentation demo project for "Prototyping iPhone app with Xcode and Storyboard"
Objective-C
1
star