Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some getters moved to public, little refactoring and Xcode 7 project fixes #264

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# OS
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
#Pods/
5 changes: 4 additions & 1 deletion Examples/Simple/RESideMenuExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = DEMO;
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0710;
ORGANIZATIONNAME = "Roman Efimov";
};
buildConfigurationList = 3032B90A1807338200064F85 /* Build configuration list for PBXProject "RESideMenuExample" */;
Expand Down Expand Up @@ -255,6 +255,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -316,6 +317,7 @@
GCC_PREFIX_HEADER = "RESideMenuExample/RESideMenuExample-Prefix.pch";
INFOPLIST_FILE = "RESideMenuExample/RESideMenuExample-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.romanefimov.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
Expand All @@ -331,6 +333,7 @@
GCC_PREFIX_HEADER = "RESideMenuExample/RESideMenuExample-Prefix.pch";
INFOPLIST_FILE = "RESideMenuExample/RESideMenuExample-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.romanefimov.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.romanefimov.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = DEMO;
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0710;
ORGANIZATIONNAME = "Roman Efimov";
};
buildConfigurationList = 3076CDB91809B47200527E6C /* Build configuration list for PBXProject "RESideMenuStoryboardsExample" */;
Expand Down Expand Up @@ -274,6 +274,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -335,6 +336,7 @@
GCC_PREFIX_HEADER = "RESideMenuStoryboardsExample/RESideMenuStoryboardsExample-Prefix.pch";
INFOPLIST_FILE = "RESideMenuStoryboardsExample/RESideMenuStoryboardsExample-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_BUNDLE_IDENTIFIER = "Roman-Efimov.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
Expand All @@ -350,6 +352,7 @@
GCC_PREFIX_HEADER = "RESideMenuStoryboardsExample/RESideMenuStoryboardsExample-Prefix.pch";
INFOPLIST_FILE = "RESideMenuStoryboardsExample/RESideMenuStoryboardsExample-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_BUNDLE_IDENTIFIER = "Roman-Efimov.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>Roman-Efimov.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
74 changes: 39 additions & 35 deletions RESideMenu/RESideMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,44 +35,48 @@
@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;
@property (strong, nonatomic) IBInspectable NSString *contentViewStoryboardID;
@property (strong, nonatomic) IBInspectable NSString *leftMenuViewStoryboardID;
@property (strong, 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 (strong, nonatomic) UIViewController *contentViewController;
@property (strong, nonatomic) UIViewController *leftMenuViewController;
@property (strong, nonatomic) UIViewController *rightMenuViewController;
@property (weak, 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 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 contentViewFadeOutAlpha;
@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 (assign, nonatomic) NSTimeInterval animationDuration;
@property (strong, nonatomic) UIImage *backgroundImage;
@property (assign, nonatomic) BOOL panGestureEnabled;
@property (assign, nonatomic) BOOL panFromEdge;
@property (assign, nonatomic) NSUInteger panMinimumOpenThreshold;
@property (assign, nonatomic) IBInspectable BOOL interactivePopGestureRecognizerEnabled;
@property (assign, nonatomic) IBInspectable BOOL fadeMenuView;
@property (assign, nonatomic) IBInspectable BOOL scaleContentView;
@property (assign, nonatomic) IBInspectable BOOL scaleBackgroundImageView;
@property (assign, nonatomic) IBInspectable BOOL scaleMenuView;
@property (assign, nonatomic) IBInspectable BOOL contentViewShadowEnabled;
@property (strong, nonatomic) IBInspectable UIColor *contentViewShadowColor;
@property (assign, nonatomic) IBInspectable CGSize contentViewShadowOffset;
@property (assign, nonatomic) IBInspectable CGFloat contentViewShadowOpacity;
@property (assign, nonatomic) IBInspectable CGFloat contentViewShadowRadius;
@property (assign, nonatomic) IBInspectable CGFloat contentViewFadeOutAlpha;
@property (assign, nonatomic) IBInspectable CGFloat contentViewScaleValue;
@property (assign, nonatomic) IBInspectable CGFloat contentViewInLandscapeOffsetCenterX;
@property (assign, nonatomic) IBInspectable CGFloat contentViewInPortraitOffsetCenterX;
@property (assign, nonatomic) IBInspectable CGFloat parallaxMenuMinimumRelativeValue;
@property (assign, nonatomic) IBInspectable CGFloat parallaxMenuMaximumRelativeValue;
@property (assign, nonatomic) IBInspectable CGFloat parallaxContentMinimumRelativeValue;
@property (assign, nonatomic) IBInspectable CGFloat parallaxContentMaximumRelativeValue;
@property (assign, nonatomic) CGAffineTransform menuViewControllerTransformation;
@property (assign, nonatomic) IBInspectable BOOL parallaxEnabled;
@property (assign, nonatomic) IBInspectable BOOL bouncesHorizontally;
@property (assign, nonatomic) UIStatusBarStyle menuPreferredStatusBarStyle;
@property (assign, nonatomic) IBInspectable BOOL menuPrefersStatusBarHidden;

@property (readonly, nonatomic, getter=isVisible) BOOL visible;
@property (readonly, nonatomic, getter=isLeftMenuVisible) BOOL leftMenuVisible;
@property (readonly, nonatomic, getter=isRightMenuVisible) BOOL rightMenuVisible;

- (id)initWithContentViewController:(UIViewController *)contentViewController
leftMenuViewController:(UIViewController *)leftMenuViewController
Expand Down
33 changes: 20 additions & 13 deletions RESideMenu/RESideMenu.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@

@interface RESideMenu ()

@property (strong, readwrite, nonatomic) UIImageView *backgroundImageView;
@property (assign, readwrite, nonatomic) BOOL visible;
@property (assign, readwrite, nonatomic) BOOL leftMenuVisible;
@property (assign, readwrite, nonatomic) BOOL rightMenuVisible;
@property (assign, readwrite, nonatomic) CGPoint originalPoint;
@property (strong, readwrite, nonatomic) UIButton *contentButton;
@property (strong, readwrite, nonatomic) UIView *menuViewContainer;
@property (strong, readwrite, nonatomic) UIView *contentViewContainer;
@property (assign, readwrite, nonatomic) BOOL didNotifyDelegate;
@property (strong, nonatomic) UIImageView *backgroundImageView;
@property (assign, nonatomic, getter=isVisible) BOOL visible;
@property (assign, nonatomic, getter=isLeftMenuVisible) BOOL leftMenuVisible;
@property (assign, nonatomic, getter=isRightMenuVisible) BOOL rightMenuVisible;
@property (assign, nonatomic) CGPoint originalPoint;
@property (strong, nonatomic) UIButton *contentButton;
@property (strong, nonatomic) UIView *menuViewContainer;
@property (strong, nonatomic) UIView *contentViewContainer;
@property (assign, nonatomic) BOOL didNotifyDelegate;

@end

Expand Down Expand Up @@ -144,6 +144,13 @@ - (void)presentRightMenuViewController
}

- (void)hideMenuViewController
{
if (self.leftMenuVisible || self.rightMenuVisible) {
[self forceHideMenuViewController];
}
}

- (void)forceHideMenuViewController
{
[self hideMenuViewControllerAnimated:YES];
}
Expand Down Expand Up @@ -195,7 +202,7 @@ - (void)viewDidLoad
});
self.contentButton = ({
UIButton *button = [[UIButton alloc] initWithFrame:CGRectNull];
[button addTarget:self action:@selector(hideMenuViewController) forControlEvents:UIControlEventTouchUpInside];
[button addTarget:self action:@selector(forceHideMenuViewController) forControlEvents:UIControlEventTouchUpInside];
button;
});

Expand Down Expand Up @@ -678,15 +685,15 @@ - (void)panGestureRecognized:(UIPanGestureRecognizer *)recognizer
(self.contentViewContainer.frame.origin.x < 0 && self.contentViewContainer.frame.origin.x > -((NSInteger)self.panMinimumOpenThreshold)) ||
(self.contentViewContainer.frame.origin.x > 0 && self.contentViewContainer.frame.origin.x < self.panMinimumOpenThreshold))
) {
[self hideMenuViewController];
[self forceHideMenuViewController];
}
else if (self.contentViewContainer.frame.origin.x == 0) {
[self hideMenuViewControllerAnimated:NO];
}
else {
if ([recognizer velocityInView:self.view].x > 0) {
if (self.contentViewContainer.frame.origin.x < 0) {
[self hideMenuViewController];
[self forceHideMenuViewController];
} else {
if (self.leftMenuViewController) {
[self showLeftMenuViewController];
Expand All @@ -698,7 +705,7 @@ - (void)panGestureRecognized:(UIPanGestureRecognizer *)recognizer
[self showRightMenuViewController];
}
} else {
[self hideMenuViewController];
[self forceHideMenuViewController];
}
}
}
Expand Down