Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4ed3655
Fixed issue #2 and issue #3
mpociot Oct 28, 2013
ccacaef
Updated Readme
mpociot Oct 28, 2013
8b1f23f
Added FXBlurView support
mpociot Nov 4, 2013
c81b229
Added FXBlurView support
mpociot Nov 4, 2013
a3363a4
Added FXBlurView support
mpociot Nov 4, 2013
9467949
Added support for blurring the background view, example and README up…
mpociot Nov 4, 2013
e546ec0
Fixed a performance issue with the dynamic property of the BlurView
mpociot Nov 4, 2013
8ebb912
Updated RESideMenu and implemented contentview animations, issue #5
mpociot Nov 18, 2013
af16032
Updated REAME to give advice upon avoiding #8
mpociot Jan 24, 2014
d85952d
Add a Bitdeli badge to README
bitdeli-chef Jan 30, 2014
9bd0cc3
Merge pull request #9 from bitdeli-chef/master
mpociot Jan 30, 2014
7ab8767
Updated RESideMenu to latest version
mpociot Jun 14, 2014
d411a94
Updated Demo.gif
mpociot Jun 14, 2014
a10a836
Renamed function to allow coexistence with NappDrawer
mpociot Jun 20, 2014
e845b52
Version 2.0
mpociot Oct 12, 2014
073c551
Update README.md
mpociot Oct 16, 2014
dc1fb22
Added 64bit support
mpociot Jan 18, 2015
c3823f6
Add support for disabling left/right pan
pitbot Jan 28, 2015
d4398f7
Update README
pitbot Jan 28, 2015
5866c24
Merge pull request #20 from pitbot/master
mpociot Jan 28, 2015
dc7ee6e
added support for scaleMenuView property
jpriebe Feb 27, 2015
f470bf5
added support for scaleMenuView property
jpriebe Feb 27, 2015
5bac518
docs cleanup
jpriebe Feb 27, 2015
dcee470
why is it so hard to get the documentation right?
jpriebe Feb 27, 2015
cd4ddf4
updated manifest and added dist zip, per Marcel
jpriebe Feb 27, 2015
6818c88
Merge pull request #21 from jpriebe/master
mpociot Feb 27, 2015
bf27ee9
Update README.md
brianjd Mar 27, 2015
fecf854
Merge pull request #22 from brianjd/master
mpociot Mar 28, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Classes/DeMarcelpociotSidemenuSideMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ UIViewController * ControllerForProxy(TiViewProxy * proxy);
}
-(RESideMenu*)controller;

-(void)presentMenuViewController:(id)args;
-(void)presentLeftMenuViewController:(id)args;
-(void)presentRightMenuViewController:(id)args;
-(void)hideMenuViewController:(id)args;


Expand Down
116 changes: 97 additions & 19 deletions Classes/DeMarcelpociotSidemenuSideMenu.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
#import "DeMarcelpociotSidemenuSideMenu.h"
#import "DeMarcelpociotSidemenuSideMenuProxy.h"
#import "TiUtils.h"
#import "TiApp.h"
#import "TiViewController.h"
#import "TiUIiOSNavWindowProxy.h"

UIViewController * ControllerForViewProxy(TiViewProxy * proxy);
UIViewController * TiSideMenuControllerForViewProxy(TiViewProxy * proxy);

UIViewController * ControllerForViewProxy(TiViewProxy * proxy)
UIViewController * TiSideMenuControllerForViewProxy(TiViewProxy * proxy)
{
[[proxy view] setAutoresizingMask:UIViewAutoresizingNone];

Expand All @@ -26,7 +27,7 @@
return [[TiViewController alloc] initWithViewProxy:proxy];
}

UINavigationController * NavigationControllerForViewProxy(TiUIiOSNavWindowProxy *proxy)
UINavigationController * TiSideMenuNavigationControllerForViewProxy(TiUIiOSNavWindowProxy *proxy)
{
return [proxy controller];
}
Expand All @@ -45,16 +46,41 @@ -(RESideMenu*)controller
}

// navController or TiWindow ?
UIViewController *centerWindow = useNavController ? NavigationControllerForViewProxy([self.proxy valueForUndefinedKey:@"contentView"]) : ControllerForViewProxy([self.proxy valueForUndefinedKey:@"contentView"]);
UIViewController *centerWindow = useNavController ? TiSideMenuNavigationControllerForViewProxy([self.proxy valueForUndefinedKey:@"contentView"]) : TiSideMenuControllerForViewProxy([self.proxy valueForUndefinedKey:@"contentView"]);

TiViewProxy *leftWindow = [self.proxy valueForUndefinedKey:@"menuView"];
UIViewController *menuViewController = ControllerForViewProxy(leftWindow);
TiViewProxy *leftWindow = [self.proxy valueForUndefinedKey:@"leftMenuView"];
TiViewProxy *rightWindow = [self.proxy valueForUndefinedKey:@"rightMenuView"];
UIViewController *leftMenuViewController = TiSideMenuControllerForViewProxy(leftWindow);
UIViewController *rightMenuViewController = TiSideMenuControllerForViewProxy(rightWindow);

controller = [[RESideMenu alloc] initWithContentViewController:centerWindow
menuViewController:menuViewController];
controller = [[RESideMenu alloc] initWithContentViewController:centerWindow
leftMenuViewController:leftMenuViewController
rightMenuViewController:rightMenuViewController];

controller.backgroundImage = [TiUtils image:[self.proxy valueForUndefinedKey:@"backgroundImage"] proxy:self.proxy];

bool blurView = [TiUtils boolValue:[self.proxy valueForUndefinedKey:@"blurBackground"] def:NO];
UIImage *backgroundImageView = [TiUtils image:[self.proxy valueForUndefinedKey:@"backgroundImage"] proxy:self.proxy];
controller.tintColor = [TiUtils colorValue:[self.proxy valueForUndefinedKey:@"tintColor"]].color;
controller.backgroundImage = backgroundImageView;

// Check creation time parameters
// setContentViewScaleValue
[controller setContentViewScaleValue:[TiUtils floatValue:[self.proxy valueForUndefinedKey:@"contentViewScaleValue"] def:0.5]];

[controller setScaleContentView:[TiUtils boolValue:[self.proxy valueForUndefinedKey:@"scaleContentView"] def:YES]];

[controller setPanGestureEnabled:[TiUtils boolValue:[self.proxy valueForUndefinedKey:@"panGestureEnabled"] def:YES]];

[controller setLeftPanEnabled:[TiUtils boolValue:[self.proxy valueForUndefinedKey:@"leftPanEnabled"] def:YES]];

[controller setRightPanEnabled:[TiUtils boolValue:[self.proxy valueForUndefinedKey:@"rightPanEnabled"] def:YES]];

[controller setScaleBackgroundImageView:[TiUtils boolValue:[self.proxy valueForUndefinedKey:@"scaleBackgroundImageView"] def:YES]];

[controller setScaleMenuView:[TiUtils boolValue:[self.proxy valueForUndefinedKey:@"scaleMenuView"] def:YES]];

[controller setParallaxEnabled:[TiUtils boolValue:[self.proxy valueForUndefinedKey:@"parallaxEnabled"] def:YES]];

UIView * controllerView = [controller view];
[controllerView setFrame:[self bounds]];
[self addSubview:controllerView];
Expand All @@ -77,19 +103,35 @@ -(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds
-(void)setContentWindow_:(id)args
{
ENSURE_UI_THREAD(setContentWindow_, args);
id window;
BOOL animated = FALSE;
if( [args respondsToSelector:@selector(objectForKey:)] )
{
window = [args objectForKey:@"window"];
animated = [TiUtils boolValue:[args objectForKey:@"animated"] def:FALSE];
} else {
window = args;
}
BOOL useNavController = FALSE;
if([[[args class] description] isEqualToString:@"TiUIiOSNavWindowProxy"]) {
if([[[window class] description] isEqualToString:@"TiUIiOSNavWindowProxy"]) {
useNavController = TRUE;
}
UIViewController *centerWindow = useNavController ? NavigationControllerForViewProxy(args) : ControllerForViewProxy(args);
[controller setContentViewController:centerWindow];
UIViewController *centerWindow = useNavController ? TiSideMenuNavigationControllerForViewProxy(window) : TiSideMenuControllerForViewProxy(window);
[controller setContentViewController:centerWindow animated:animated];
}

-(void)setLeftMenuWindow_:(id)args
{
ENSURE_UI_THREAD(setLeftMenuWindow_, args);
ENSURE_SINGLE_ARG(args, TiViewProxy);
[controller setLeftMenuViewController:args];
}

-(void)setMenuWindow_:(id)args
-(void)setRightMenuWindow_:(id)args
{
ENSURE_UI_THREAD(setMenuWindow_, args);
ENSURE_SINGLE_ARG(args, TiViewProxy);
[controller setMenuViewController:args];
ENSURE_UI_THREAD(setRightMenuWindow_, args);
ENSURE_SINGLE_ARG(args, TiViewProxy);
[controller setRightMenuViewController:args];
}

-(void)setContentViewScaleValue_:(id)args
Expand All @@ -110,23 +152,59 @@ -(void)setPanGestureEnabled_:(id)args
[controller setPanGestureEnabled:[TiUtils boolValue:args]];
}

-(void)setPanFromEdge_:(id)args
{
ENSURE_UI_THREAD(setPanFromEdge_, args);
[controller setPanFromEdge:[TiUtils boolValue:args]];
}

-(void)setMenuPrefersStatusBarHidden_:(id)args
{
ENSURE_UI_THREAD(setMenuPrefersStatusBarHidden_, args);
[controller setMenuPrefersStatusBarHidden:[TiUtils boolValue:args]];
}


-(void)setScaleBackgroundImageView_:(id)args
{
ENSURE_UI_THREAD(setScaleBackgroundImageView_, args);
[controller setScaleBackgroundImageView:[TiUtils boolValue:args]];
}

-(void)setScaleMenuView_:(id)args
{
ENSURE_UI_THREAD(setScaleMenuView_, args);
[controller setScaleMenuView:[TiUtils boolValue:args]];
}

-(void)setParallaxEnabled_:(id)args
{
ENSURE_UI_THREAD(setParallaxEnabled_, args);
[controller setParallaxEnabled:[TiUtils boolValue:args]];
}

-(void)setLeftPanEnabled_:(id)args
{
ENSURE_UI_THREAD(setLeftPanEnabled_, args);
[controller setLeftPanEnabled:[TiUtils boolValue:args]];
}

-(void)setRightPanEnabled_:(id)args
{
ENSURE_UI_THREAD(setRightPanEnabled_, args);
[controller setRightPanEnabled:[TiUtils boolValue:args]];
}

#pragma API
-(void)presentMenuViewController:(id)args
-(void)presentLeftMenuViewController:(id)args
{
ENSURE_UI_THREAD(presentLeftMenuViewController,args);
[controller presentLeftMenuViewController];
}
-(void)presentRightMenuViewController:(id)args
{
ENSURE_UI_THREAD(presentMenuViewController,args);
[controller presentMenuViewController];
ENSURE_UI_THREAD(presentRightMenuViewController,args);
[controller presentRightMenuViewController];
}

-(void)hideMenuViewController:(id)args
Expand Down
11 changes: 9 additions & 2 deletions Classes/DeMarcelpociotSidemenuSideMenuProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

@implementation DeMarcelpociotSidemenuSideMenuProxy

-(void)windowDidOpen {
[super windowDidOpen];
[self reposition];
}

-(UIViewController *)_controller {
return [(DeMarcelpociotSidemenuSideMenu*)[self view] controller];
Expand All @@ -23,8 +27,11 @@ -(TiUIView*)newView {

# pragma API

-(void)presentMenuViewController:(id)args {
TiThreadPerformOnMainThread(^{[(DeMarcelpociotSidemenuSideMenu*)[self view] presentMenuViewController:args];}, NO);
-(void)presentLeftMenuViewController:(id)args {
TiThreadPerformOnMainThread(^{[(DeMarcelpociotSidemenuSideMenu*)[self view] presentLeftMenuViewController:args];}, NO);
}
-(void)presentRightMenuViewController:(id)args {
TiThreadPerformOnMainThread(^{[(DeMarcelpociotSidemenuSideMenu*)[self view] presentRightMenuViewController:args];}, NO);
}

-(void)hideMenuViewController:(id)args {
Expand Down
10 changes: 5 additions & 5 deletions Classes/RESideMenu/RECommonFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RECommonFunctions.h
// RESideMenu
//
// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
// Copyright (c) 2013-2014 Roman Efimov (https://github.com/romaonthego)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,9 +25,9 @@

#import <Foundation/Foundation.h>

#ifndef REUIKitIsFlatModeFunction
#define REUIKitIsFlatModeFunction
BOOL REUIKitIsFlatMode();

#ifndef REUIKitIsFlatMode
#define REUIKitIsFlatMode() RESideMenuUIKitIsFlatMode()
#endif

#ifndef kCFCoreFoundationVersionNumber_iOS_6_1
Expand All @@ -44,4 +44,4 @@ __VA_ARGS__ \
#define IF_IOS7_OR_GREATER(...)
#endif

BOOL REDeviceIsUIKit7() __attribute__ ((deprecated));
BOOL RESideMenuUIKitIsFlatMode(void);
8 changes: 2 additions & 6 deletions Classes/RESideMenu/RECommonFunctions.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RECommonFunctions.m
// RESideMenu
//
// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
// Copyright (c) 2013-2014 Roman Efimov (https://github.com/romaonthego)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,12 +25,8 @@

#import "RECommonFunctions.h"
#import <UIKit/UIKit.h>
BOOL REDeviceIsUIKit7()
{
return REUIKitIsFlatMode();
}

BOOL REUIKitIsFlatMode()
BOOL RESideMenuUIKitIsFlatMode(void)
{
static BOOL isUIKitFlatMode = NO;
static dispatch_once_t onceToken;
Expand Down
70 changes: 52 additions & 18 deletions Classes/RESideMenu/RESideMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// REFrostedViewController.h
// RESideMenu
//
// Copyright (c) 2013 Roman Efimov (https://github.com/romaonthego)
// Copyright (c) 2013-2014 Roman Efimov (https://github.com/romaonthego)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,32 +26,66 @@
#import <UIKit/UIKit.h>
#import "UIViewController+RESideMenu.h"

#ifndef IBInspectable
#define IBInspectable
#endif


@protocol RESideMenuDelegate;

@interface RESideMenu : UIViewController
@interface RESideMenu : UIViewController <UIGestureRecognizerDelegate>

#if __IPHONE_8_0
@property (strong, readwrite, nonatomic) IBInspectable NSString *contentViewStoryboardID;
@property (strong, readwrite, nonatomic) IBInspectable NSString *leftMenuViewStoryboardID;
@property (strong, readwrite, nonatomic) IBInspectable NSString *rightMenuViewStoryboardID;
#endif

@property (strong, readwrite, nonatomic) UIViewController *contentViewController;
@property (strong, readwrite, nonatomic) UIViewController *leftMenuViewController;
@property (strong, readwrite, nonatomic) UIViewController *rightMenuViewController;
@property (weak, readwrite, nonatomic) id<RESideMenuDelegate> delegate;

@property (assign, readwrite, nonatomic) NSTimeInterval animationDuration;
@property (strong, readwrite, nonatomic) UIImage *backgroundImage;
@property (assign, readwrite, nonatomic) BOOL panGestureEnabled;
@property (assign, readwrite, nonatomic) BOOL scaleContentView;
@property (assign, readwrite, nonatomic) BOOL scaleBackgroundImageView;
@property (assign, readwrite, nonatomic) CGFloat contentViewScaleValue;
@property (assign, readwrite, nonatomic) CGFloat contentViewInLandscapeOffsetCenterX;
@property (assign, readwrite, nonatomic) CGFloat contentViewInPortraitOffsetCenterX;
@property (strong, readwrite, nonatomic) id parallaxMenuMinimumRelativeValue;
@property (strong, readwrite, nonatomic) id parallaxMenuMaximumRelativeValue;
@property (strong, readwrite, nonatomic) id parallaxContentMinimumRelativeValue;
@property (strong, readwrite, nonatomic) id parallaxContentMaximumRelativeValue;
@property (assign, readwrite, nonatomic) BOOL parallaxEnabled;
@property (assign, readwrite, nonatomic) BOOL leftPanEnabled;
@property (assign, readwrite, nonatomic) BOOL rightPanEnabled;
@property (assign, readwrite, nonatomic) BOOL panFromEdge;
@property (assign, readwrite, nonatomic) NSUInteger panMinimumOpenThreshold;
@property (assign, readwrite, nonatomic) IBInspectable BOOL interactivePopGestureRecognizerEnabled;
@property (assign, readwrite, nonatomic) IBInspectable BOOL fadeMenuView;
@property (assign, readwrite, nonatomic) IBInspectable BOOL scaleContentView;
@property (assign, readwrite, nonatomic) IBInspectable BOOL scaleBackgroundImageView;
@property (assign, readwrite, nonatomic) IBInspectable BOOL scaleMenuView;
@property (assign, readwrite, nonatomic) IBInspectable BOOL contentViewShadowEnabled;
@property (strong, readwrite, nonatomic) IBInspectable UIColor *contentViewShadowColor;
@property (assign, readwrite, nonatomic) IBInspectable CGSize contentViewShadowOffset;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewShadowOpacity;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewShadowRadius;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewScaleValue;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewInLandscapeOffsetCenterX;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewInPortraitOffsetCenterX;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxMenuMinimumRelativeValue;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxMenuMaximumRelativeValue;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxContentMinimumRelativeValue;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxContentMaximumRelativeValue;
@property (assign, readwrite, nonatomic) CGAffineTransform menuViewControllerTransformation;
@property (assign, readwrite, nonatomic) IBInspectable BOOL parallaxEnabled;
@property (assign, readwrite, nonatomic) IBInspectable BOOL bouncesHorizontally;
@property (assign, readwrite, nonatomic) UIStatusBarStyle menuPreferredStatusBarStyle;
@property (assign, readwrite, nonatomic) IBInspectable BOOL menuPrefersStatusBarHidden;

@property (strong, readwrite, nonatomic) UIViewController *contentViewController;
@property (strong, readwrite, nonatomic) UIViewController *menuViewController;
@property (assign, readwrite, nonatomic) UIColor *tintColor;

@property (weak, readwrite, nonatomic) id<RESideMenuDelegate> delegate;

- (id)initWithContentViewController:(UIViewController *)contentViewController menuViewController:(UIViewController *)menuViewController;
- (void)presentMenuViewController;
- (id)initWithContentViewController:(UIViewController *)contentViewController
leftMenuViewController:(UIViewController *)leftMenuViewController
rightMenuViewController:(UIViewController *)rightMenuViewController;
- (void)presentLeftMenuViewController;
- (void)presentRightMenuViewController;
- (void)hideMenuViewController;
- (void)setContentViewController:(UIViewController *)contentViewController animated:(BOOL)animated;

@end

Expand All @@ -64,4 +98,4 @@
- (void)sideMenu:(RESideMenu *)sideMenu willHideMenuViewController:(UIViewController *)menuViewController;
- (void)sideMenu:(RESideMenu *)sideMenu didHideMenuViewController:(UIViewController *)menuViewController;

@end
@end
Loading