forked from John-Lluch/SWRevealViewController
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joan Lluch
committed
Jul 3, 2014
1 parent
94dc998
commit e864226
Showing
22 changed files
with
961 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/AppDelegate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// AppDelegate.h | ||
// RevealControllerStoryboardExample | ||
// | ||
// Created by Nick Hodapp on 1/9/13. | ||
// Copyright (c) 2013 CoDeveloper. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface AppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property (strong, nonatomic) UIWindow *window; | ||
|
||
@end |
46 changes: 46 additions & 0 deletions
46
RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/AppDelegate.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// AppDelegate.m | ||
// RevealControllerStoryboardExample | ||
// | ||
// Created by Nick Hodapp on 1/9/13. | ||
// Copyright (c) 2013 CoDeveloper. All rights reserved. | ||
// | ||
|
||
#import "AppDelegate.h" | ||
|
||
@implementation AppDelegate | ||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
{ | ||
// Override point for customization after application launch. | ||
return YES; | ||
} | ||
|
||
- (void)applicationWillResignActive:(UIApplication *)application | ||
{ | ||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
} | ||
|
||
- (void)applicationDidEnterBackground:(UIApplication *)application | ||
{ | ||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
} | ||
|
||
- (void)applicationWillEnterForeground:(UIApplication *)application | ||
{ | ||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | ||
} | ||
|
||
- (void)applicationDidBecomeActive:(UIApplication *)application | ||
{ | ||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
} | ||
|
||
- (void)applicationWillTerminate:(UIApplication *)application | ||
{ | ||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | ||
} | ||
|
||
@end |
15 changes: 15 additions & 0 deletions
15
RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/ColorViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// ColorViewController.h | ||
// RevealControllerStoryboardExample | ||
// | ||
// Created by Nick Hodapp on 1/9/13. | ||
// Copyright (c) 2013 CoDeveloper. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface ColorViewController : UIViewController | ||
@property (nonatomic, strong) IBOutlet UILabel* label; | ||
@property (nonatomic, strong) UIColor* color; | ||
@property (nonatomic, strong) NSString* text; | ||
@end |
29 changes: 29 additions & 0 deletions
29
RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/ColorViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// ColorViewController.m | ||
// RevealControllerStoryboardExample | ||
// | ||
// Created by Nick Hodapp on 1/9/13. | ||
// Copyright (c) 2013 CoDeveloper. All rights reserved. | ||
// | ||
|
||
#import "ColorViewController.h" | ||
|
||
@interface ColorViewController () | ||
@property (nonatomic) IBOutlet UIBarButtonItem* revealButtonItem; | ||
@end | ||
|
||
@implementation ColorViewController | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
|
||
[self.revealButtonItem setTarget: self.revealViewController]; | ||
[self.revealButtonItem setAction: @selector( revealToggle: )]; | ||
[self.navigationController.navigationBar addGestureRecognizer: self.revealViewController.panGestureRecognizer]; | ||
|
||
_label.text = _text; | ||
_label.textColor = _color; | ||
} | ||
|
||
@end |
Binary file added
BIN
+18.2 KB
...rollerStoryboardExample2/RevealControllerStoryboardExample2/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.39 KB
RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.7 KB
...lControllerStoryboardExample2/RevealControllerStoryboardExample2/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/MapViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// MapViewController.h | ||
// RevealControllerStoryboardExample | ||
// | ||
// Created by Nick Hodapp on 1/9/13. | ||
// Copyright (c) 2013 CoDeveloper. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface MapViewController : UIViewController | ||
|
||
@end |
26 changes: 26 additions & 0 deletions
26
RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/MapViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// MapViewController.m | ||
// RevealControllerStoryboardExample | ||
// | ||
// Created by Nick Hodapp on 1/9/13. | ||
// Copyright (c) 2013 CoDeveloper. All rights reserved. | ||
// | ||
|
||
#import "MapViewController.h" | ||
|
||
@interface MapViewController () | ||
@property (nonatomic) IBOutlet UIBarButtonItem* revealButtonItem; | ||
@end | ||
|
||
@implementation MapViewController | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
|
||
[self.revealButtonItem setTarget: self.revealViewController]; | ||
[self.revealButtonItem setAction: @selector( revealToggle: )]; | ||
[self.navigationController.navigationBar addGestureRecognizer: self.revealViewController.panGestureRecognizer]; | ||
} | ||
|
||
@end |
17 changes: 17 additions & 0 deletions
17
RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/MenuViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// MenuViewController.h | ||
// RevealControllerStoryboardExample | ||
// | ||
// Created by Nick Hodapp on 1/9/13. | ||
// Copyright (c) 2013 CoDeveloper. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface SWUITableViewCell : UITableViewCell | ||
@property (nonatomic) IBOutlet UILabel *label; | ||
@end | ||
|
||
@interface MenuViewController : UITableViewController | ||
|
||
@end |
102 changes: 102 additions & 0 deletions
102
RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/MenuViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// | ||
// MenuViewController.m | ||
// RevealControllerStoryboardExample | ||
// | ||
// Created by Nick Hodapp on 1/9/13. | ||
// Copyright (c) 2013 CoDeveloper. All rights reserved. | ||
// | ||
|
||
#import "MenuViewController.h" | ||
#import "ColorViewController.h" | ||
|
||
@implementation SWUITableViewCell | ||
@end | ||
|
||
@implementation MenuViewController | ||
|
||
- (void) prepareForSegueB: (UIStoryboardSegue *) segue sender: (id) sender | ||
{ | ||
// configure the destination view controller: | ||
if ( [segue.destinationViewController isKindOfClass: [ColorViewController class]] && | ||
[sender isKindOfClass:[UITableViewCell class]] ) | ||
{ | ||
UILabel* c = [(SWUITableViewCell *)sender label]; | ||
ColorViewController* cvc = segue.destinationViewController; | ||
|
||
cvc.color = c.textColor; | ||
cvc.text = c.text; | ||
} | ||
|
||
// configure the segue. | ||
if ( [segue isKindOfClass: [SWRevealViewControllerSegue class]] ) | ||
{ | ||
SWRevealViewControllerSegue* rvcs = (SWRevealViewControllerSegue*) segue; | ||
|
||
SWRevealViewController* rvc = self.revealViewController; | ||
NSAssert( rvc != nil, @"oops! must have a revealViewController" ); | ||
|
||
NSAssert( [rvc.frontViewController isKindOfClass: [UINavigationController class]], @"oops! for this segue we want a permanent navigation controller in the front!" ); | ||
|
||
rvcs.performBlock = ^(SWRevealViewControllerSegue* rvc_segue, UIViewController* svc, UIViewController* dvc) | ||
{ | ||
UINavigationController* nc = [[UINavigationController alloc] initWithRootViewController:dvc]; | ||
[rvc pushFrontViewController:nc animated:YES]; | ||
}; | ||
} | ||
} | ||
|
||
|
||
- (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender | ||
{ | ||
// configure the destination view controller: | ||
if ( [sender isKindOfClass:[UITableViewCell class]] ) | ||
{ | ||
UILabel* c = [(SWUITableViewCell *)sender label]; | ||
UINavigationController *navController = segue.destinationViewController; | ||
ColorViewController* cvc = [navController childViewControllers].firstObject; | ||
if ( [cvc isKindOfClass:[ColorViewController class]] ) | ||
{ | ||
cvc.color = c.textColor; | ||
cvc.text = c.text; | ||
} | ||
} | ||
} | ||
|
||
|
||
#pragma mark - Table view data source | ||
|
||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | ||
{ | ||
return 1; | ||
} | ||
|
||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | ||
{ | ||
return 3; | ||
} | ||
|
||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | ||
{ | ||
static NSString *CellIdentifier = @"Cell"; | ||
|
||
switch ( indexPath.row ) | ||
{ | ||
case 0: | ||
CellIdentifier = @"map"; | ||
break; | ||
|
||
case 1: | ||
CellIdentifier = @"blue"; | ||
break; | ||
|
||
case 2: | ||
CellIdentifier = @"red"; | ||
break; | ||
} | ||
|
||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier forIndexPath: indexPath]; | ||
|
||
return cell; | ||
} | ||
|
||
@end |
2 changes: 2 additions & 0 deletions
2
...ontrollerStoryboardExample2/RevealControllerStoryboardExample2/en.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/* Localized versions of Info.plist keys */ | ||
|
Oops, something went wrong.