forked from stefanoa/SASlideMenu
-
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.
added an iPad example in SASlideMenuiPad
- Loading branch information
Showing
21 changed files
with
897 additions
and
40 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
// | ||
// ExampleiPadAppDelegate.h | ||
// SASlideMenuiPad | ||
// | ||
// Created by Stefano Antonelli on 3/13/13. | ||
// Copyright (c) 2013 Stefano Antonelli. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface ExampleiPadAppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property (strong, nonatomic) UIWindow *window; | ||
|
||
@end |
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 @@ | ||
// | ||
// ExampleiPadAppDelegate.m | ||
// SASlideMenuiPad | ||
// | ||
// Created by Stefano Antonelli on 3/13/13. | ||
// Copyright (c) 2013 Stefano Antonelli. All rights reserved. | ||
// | ||
|
||
#import "ExampleiPadAppDelegate.h" | ||
|
||
@implementation ExampleiPadAppDelegate | ||
|
||
- (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 |
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,16 @@ | ||
// | ||
// ExampleiPadViewController.h | ||
// SASlideMenuiPad | ||
// | ||
// Created by Stefano Antonelli on 3/13/13. | ||
// Copyright (c) 2013 Stefano Antonelli. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "SASlideMenuViewController.h" | ||
#import "SASlideMenuDataSource.h" | ||
#import "SASlideMenuDelegate.h" | ||
|
||
@interface ExampleiPadViewController : SASlideMenuViewController<SASlideMenuDataSource,SASlideMenuDelegate, UITableViewDataSource> | ||
|
||
@end |
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,160 @@ | ||
// | ||
// ExampleiPadViewController.m | ||
// SASlideMenuiPad | ||
// | ||
// Created by Stefano Antonelli on 3/13/13. | ||
// Copyright (c) 2013 Stefano Antonelli. All rights reserved. | ||
// | ||
|
||
#import "ExampleiPadViewController.h" | ||
#import "ColoredViewController.h" | ||
#import "SASlideMenuRootViewController.h" | ||
|
||
@interface ExampleiPadViewController () | ||
@property (nonatomic) CGFloat selectedHue; | ||
@property (nonatomic) CGFloat selectedBrightness; | ||
|
||
@end | ||
|
||
@implementation ExampleiPadViewController | ||
|
||
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ | ||
return YES; | ||
} | ||
|
||
#pragma mark - | ||
#pragma mark SASlideMenuDataSource | ||
|
||
-(void) prepareForSwitchToContentViewController:(UINavigationController *)content{ | ||
UIViewController* controller = [content.viewControllers objectAtIndex:0]; | ||
if ([controller isKindOfClass:[ColoredViewController class]]) { | ||
ColoredViewController* coloredViewController = (ColoredViewController*) controller; | ||
[coloredViewController setBackgroundHue:self.selectedHue brightness:self.selectedBrightness]; | ||
} | ||
} | ||
|
||
// It configure the menu button. The beahviour of the button should not be modified | ||
-(void) configureMenuButton:(UIButton *)menuButton{ | ||
menuButton.frame = CGRectMake(0, 0, 40, 29); | ||
[menuButton setImage:[UIImage imageNamed:@"menuicon.png"] forState:UIControlStateNormal]; | ||
[menuButton setBackgroundImage:[UIImage imageNamed:@"menu.png"] forState:UIControlStateNormal]; | ||
[menuButton setBackgroundImage:[UIImage imageNamed:@"menuhighlighted.png"] forState:UIControlStateHighlighted]; | ||
[menuButton setAdjustsImageWhenHighlighted:NO]; | ||
[menuButton setAdjustsImageWhenDisabled:NO]; | ||
} | ||
|
||
// It configure the right menu button. The beahviour of the button should not be modified | ||
-(void) configureRightMenuButton:(UIButton *)menuButton{ | ||
menuButton.frame = CGRectMake(0, 0, 40, 29); | ||
[menuButton setImage:[UIImage imageNamed:@"menuright.png"] forState:UIControlStateNormal]; | ||
[menuButton setBackgroundImage:[UIImage imageNamed:@"menu.png"] forState:UIControlStateNormal]; | ||
[menuButton setBackgroundImage:[UIImage imageNamed:@"menuhighlighted.png"] forState:UIControlStateHighlighted]; | ||
[menuButton setAdjustsImageWhenHighlighted:NO]; | ||
[menuButton setAdjustsImageWhenDisabled:NO]; | ||
} | ||
|
||
// This is the segue you want visibile when the controller is loaded the first time | ||
-(NSIndexPath*) selectedIndexPath{ | ||
return [NSIndexPath indexPathForRow:0 inSection:0]; | ||
} | ||
|
||
// It maps each indexPath to the segueId to be used. The segue is performed only the first time the controller needs to loaded, subsequent switch to the content controller will use the already loaded controller | ||
|
||
-(NSString*) segueIdForIndexPath:(NSIndexPath *)indexPath{ | ||
return @"colored"; | ||
} | ||
|
||
#pragma mark - | ||
#pragma mark UITableViewDataSource | ||
|
||
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{ | ||
return 3; | ||
} | ||
|
||
-(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ | ||
if (section == 0) { | ||
return @"Red"; | ||
}else if (section == 1){ | ||
return @"Green"; | ||
}else { | ||
return @"Blue"; | ||
} | ||
} | ||
|
||
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ | ||
return 4; | ||
} | ||
-(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
CGFloat brightness = 1-((double) indexPath.row)/5; | ||
NSInteger section = indexPath.section; | ||
CGFloat hue=0; | ||
if (section == 0) { | ||
hue = 0.0; | ||
}else if (section==1){ | ||
hue = 0.33; | ||
}else if (section==2){ | ||
hue = 0.66; | ||
} | ||
cell.backgroundColor = [UIColor colorWithHue:hue saturation:1.0 brightness:brightness alpha:1.0]; | ||
} | ||
|
||
-(UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
UITableViewCell* cell = [self.tableView dequeueReusableCellWithIdentifier:@"item"]; | ||
return cell; | ||
} | ||
|
||
-(CGFloat) leftMenuVisibleWidth{ | ||
return 600; | ||
} | ||
|
||
-(CGFloat) rightMenuVisibleWidth{ | ||
return 300; | ||
} | ||
|
||
#pragma mark - | ||
#pragma mark UITableViewDelegate | ||
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
CGFloat brightness = 1-((double) indexPath.row)/5; | ||
NSInteger section = indexPath.section; | ||
CGFloat hue=0; | ||
if (section == 0) { | ||
hue = 0.0; | ||
}else if (section==1){ | ||
hue = 0.33; | ||
}else if (section==2){ | ||
hue = 0.66; | ||
} | ||
self.selectedHue = hue; | ||
self.selectedBrightness = brightness; | ||
[super tableView:tableView didSelectRowAtIndexPath:indexPath]; | ||
} | ||
|
||
#pragma mark - | ||
#pragma mark SASlideMenuDelegate | ||
|
||
-(void) slideMenuWillSlideIn{ | ||
NSLog(@"slideMenuWillSlideIn"); | ||
} | ||
-(void) slideMenuDidSlideIn{ | ||
NSLog(@"slideMenuDidSlideIn"); | ||
} | ||
-(void) slideMenuWillSlideToSide{ | ||
NSLog(@"slideMenuWillSlideToSide"); | ||
} | ||
-(void) slideMenuDidSlideToSide{ | ||
NSLog(@"slideMenuDidSlideToSide"); | ||
} | ||
-(void) slideMenuWillSlideOut{ | ||
NSLog(@"slideMenuWillSlideOut"); | ||
} | ||
-(void) slideMenuDidSlideOut{ | ||
NSLog(@"slideMenuDidSlideOut"); | ||
} | ||
-(void) slideMenuWillSlideToLeft{ | ||
NSLog(@"slideMenuWillSlideToLeft"); | ||
} | ||
-(void) slideMenuDidSlideToLeft{ | ||
NSLog(@"slideMenuDidSlideToLeft"); | ||
} | ||
|
||
@end |
Oops, something went wrong.