diff --git a/RevealControllerExample/RevealControllerProject.xcodeproj/project.pbxproj b/RevealControllerExample/RevealControllerProject.xcodeproj/project.pbxproj
index c00cd79..bbb8e0d 100755
--- a/RevealControllerExample/RevealControllerProject.xcodeproj/project.pbxproj
+++ b/RevealControllerExample/RevealControllerProject.xcodeproj/project.pbxproj
@@ -236,7 +236,7 @@
5E605B9C14A081F900853025 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0630;
+ LastUpgradeCheck = 0700;
};
buildConfigurationList = 5E605B9F14A081F900853025 /* Build configuration list for PBXProject "RevealControllerProject" */;
compatibilityVersion = "Xcode 3.2";
@@ -342,6 +342,7 @@
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@@ -407,6 +408,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RevealControllerProject/Project-Prefix.pch";
INFOPLIST_FILE = "RevealControllerProject/RevealControllerProject-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.zuui.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -418,6 +420,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RevealControllerProject/Project-Prefix.pch";
INFOPLIST_FILE = "RevealControllerProject/RevealControllerProject-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.zuui.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
diff --git a/RevealControllerExample/RevealControllerProject/RevealControllerProject-Info.plist b/RevealControllerExample/RevealControllerProject/RevealControllerProject-Info.plist
index 33727c6..ff11304 100755
--- a/RevealControllerExample/RevealControllerProject/RevealControllerProject-Info.plist
+++ b/RevealControllerExample/RevealControllerProject/RevealControllerProject-Info.plist
@@ -11,7 +11,7 @@
CFBundleIconFiles
CFBundleIdentifier
- org.zuui.${PRODUCT_NAME:rfc1034identifier}
+ $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
diff --git a/RevealControllerExample2/RevealControllerProject2.xcodeproj/project.pbxproj b/RevealControllerExample2/RevealControllerProject2.xcodeproj/project.pbxproj
index 48d0c0a..989e64a 100755
--- a/RevealControllerExample2/RevealControllerProject2.xcodeproj/project.pbxproj
+++ b/RevealControllerExample2/RevealControllerProject2.xcodeproj/project.pbxproj
@@ -208,7 +208,7 @@
5E605B9C14A081F900853025 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0430;
+ LastUpgradeCheck = 0700;
};
buildConfigurationList = 5E605B9F14A081F900853025 /* Build configuration list for PBXProject "RevealControllerProject2" */;
compatibilityVersion = "Xcode 3.2";
@@ -300,13 +300,22 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJCPP_ARC_ABI = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@@ -314,10 +323,15 @@
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+ ONLY_ACTIVE_ARCH = YES;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -328,15 +342,27 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJCPP_ARC_ABI = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
@@ -353,6 +379,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RevealControllerProject2/Project-Prefix.pch";
INFOPLIST_FILE = "RevealControllerProject2/RevealControllerProject-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.zuui.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
@@ -366,6 +393,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RevealControllerProject2/Project-Prefix.pch";
INFOPLIST_FILE = "RevealControllerProject2/RevealControllerProject-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.zuui.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
diff --git a/RevealControllerExample2/RevealControllerProject2/RearViewController.m b/RevealControllerExample2/RevealControllerProject2/RearViewController.m
index 2e26208..d115fcc 100755
--- a/RevealControllerExample2/RevealControllerProject2/RearViewController.m
+++ b/RevealControllerExample2/RevealControllerProject2/RearViewController.m
@@ -101,7 +101,7 @@ - (void)viewDidLoad
while( nil != (controller = [controller revealViewController]) )
level++;
- NSString *title = [NSString stringWithFormat:@"Detail Level %d", level];
+ NSString *title = [NSString stringWithFormat:@"Detail Level %ld", (long)level];
[self.navigationController.navigationBar addGestureRecognizer:grandParentRevealController.panGestureRecognizer];
self.navigationItem.leftBarButtonItem = revealButtonItem;
diff --git a/RevealControllerExample2/RevealControllerProject2/RevealControllerProject-Info.plist b/RevealControllerExample2/RevealControllerProject2/RevealControllerProject-Info.plist
index 33727c6..ff11304 100755
--- a/RevealControllerExample2/RevealControllerProject2/RevealControllerProject-Info.plist
+++ b/RevealControllerExample2/RevealControllerProject2/RevealControllerProject-Info.plist
@@ -11,7 +11,7 @@
CFBundleIconFiles
CFBundleIdentifier
- org.zuui.${PRODUCT_NAME:rfc1034identifier}
+ $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
diff --git a/RevealControllerExample3/RevealControllerProject3.xcodeproj/project.pbxproj b/RevealControllerExample3/RevealControllerProject3.xcodeproj/project.pbxproj
index 40bb92f..742aba2 100755
--- a/RevealControllerExample3/RevealControllerProject3.xcodeproj/project.pbxproj
+++ b/RevealControllerExample3/RevealControllerProject3.xcodeproj/project.pbxproj
@@ -269,7 +269,7 @@
5E605B9C14A081F900853025 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0430;
+ LastUpgradeCheck = 0700;
};
buildConfigurationList = 5E605B9F14A081F900853025 /* Build configuration list for PBXProject "RevealControllerProject3" */;
compatibilityVersion = "Xcode 3.2";
@@ -354,13 +354,22 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJCPP_ARC_ABI = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@@ -368,10 +377,15 @@
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+ ONLY_ACTIVE_ARCH = YES;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -382,15 +396,27 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJCPP_ARC_ABI = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
@@ -407,6 +433,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RevealControllerProject3/Project-Prefix.pch";
INFOPLIST_FILE = "RevealControllerProject3/RevealControllerProject-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.zuui.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
@@ -420,6 +447,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RevealControllerProject3/Project-Prefix.pch";
INFOPLIST_FILE = "RevealControllerProject3/RevealControllerProject-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.zuui.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
diff --git a/RevealControllerExample3/RevealControllerProject3/RevealControllerProject-Info.plist b/RevealControllerExample3/RevealControllerProject3/RevealControllerProject-Info.plist
index 33727c6..ff11304 100755
--- a/RevealControllerExample3/RevealControllerProject3/RevealControllerProject-Info.plist
+++ b/RevealControllerExample3/RevealControllerProject3/RevealControllerProject-Info.plist
@@ -11,7 +11,7 @@
CFBundleIconFiles
CFBundleIdentifier
- org.zuui.${PRODUCT_NAME:rfc1034identifier}
+ $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
diff --git a/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2.xcodeproj/project.pbxproj b/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2.xcodeproj/project.pbxproj
index f5bb3ab..102caf5 100644
--- a/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2.xcodeproj/project.pbxproj
+++ b/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2.xcodeproj/project.pbxproj
@@ -178,7 +178,7 @@
01FB865C169E2D8B00A0A1A8 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0450;
+ LastUpgradeCheck = 0700;
ORGANIZATIONNAME = CoDeveloper;
};
buildConfigurationList = 01FB865F169E2D8B00A0A1A8 /* Build configuration list for PBXProject "RevealControllerStoryboardExample2" */;
@@ -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;
@@ -319,6 +320,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RevealControllerStoryboardExample2/RevealControllerStoryboardExample2-Prefix.pch";
INFOPLIST_FILE = "RevealControllerStoryboardExample2/RevealControllerStoryboardExample2-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.codeveloper.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
@@ -331,6 +333,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RevealControllerStoryboardExample2/RevealControllerStoryboardExample2-Prefix.pch";
INFOPLIST_FILE = "RevealControllerStoryboardExample2/RevealControllerStoryboardExample2-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.codeveloper.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
diff --git a/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2-Info.plist b/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2-Info.plist
index f3ed296..28db565 100755
--- a/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2-Info.plist
+++ b/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2/RevealControllerStoryboardExample2-Info.plist
@@ -9,7 +9,7 @@
CFBundleExecutable
${EXECUTABLE_NAME}
CFBundleIdentifier
- com.codeveloper.${PRODUCT_NAME:rfc1034identifier}
+ $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
diff --git a/SWRevealViewController/SWRevealViewController.m b/SWRevealViewController/SWRevealViewController.m
index d378d13..b680421 100755
--- a/SWRevealViewController/SWRevealViewController.m
+++ b/SWRevealViewController/SWRevealViewController.m
@@ -1,5 +1,5 @@
/*
-
+
Copyright (c) 2013 Joan Lluch
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,10 +19,10 @@ of this software and associated documentation files (the "Software"), to deal
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-
+
Early code inspired on a similar class by Philip Kluz (Philip.Kluz@zuui.org)
-*/
+ */
#import
@@ -42,7 +42,7 @@ static CGFloat statusBarAdjustment( UIView* view )
if ( CGRectIntersectsRect(viewFrame, statusBarFrame) )
adjustment = fminf(statusBarFrame.size.width, statusBarFrame.size.height);
-
+
return adjustment;
}
@@ -89,11 +89,11 @@ - (id)initWithFrame:(CGRect)frame controller:(SWRevealViewController*)controller
{
_c = controller;
CGRect bounds = self.bounds;
-
+
_frontView = [[UIView alloc] initWithFrame:bounds];
_frontView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
[self reloadShadow];
-
+
[self addSubview:_frontView];
}
return self;
@@ -154,20 +154,6 @@ - (void)prepareRightViewForPosition:(FrontViewPosition)newPosition
}
-- (void)unloadRearView
-{
- [_rearView removeFromSuperview];
- _rearView = nil;
-}
-
-
-- (void)unloadRightView
-{
- [_rightView removeFromSuperview];
- _rightView = nil;
-}
-
-
- (CGFloat)frontLocationForPosition:(FrontViewPosition)frontViewPosition
{
CGFloat revealWidth;
@@ -184,7 +170,7 @@ - (CGFloat)frontLocationForPosition:(FrontViewPosition)frontViewPosition
else if ( frontViewPosition > FrontViewPositionRight )
location = revealWidth + revealOverdraw;
-
+
return location*symetry;
}
@@ -206,7 +192,7 @@ - (void)dragFrontViewToXLocation:(CGFloat)xLocation
- (void)layoutSubviews
{
if ( _disableLayout ) return;
-
+
CGRect bounds = self.bounds;
FrontViewPosition position = _c.frontViewPosition;
@@ -309,7 +295,7 @@ - (void)_prepareForNewPosition:(FrontViewPosition)newPosition;
return;
int symetry = newPosition)transitionC
{
UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
-
+
if ( fromViewController )
{
[UIView transitionFromView:fromViewController.view toView:toViewController.view duration:_duration
- options:UIViewAnimationOptionTransitionCrossDissolve|UIViewAnimationOptionOverrideInheritedOptions
- completion:^(BOOL finished) { [transitionContext completeTransition:finished]; }];
+ options:UIViewAnimationOptionTransitionCrossDissolve|UIViewAnimationOptionOverrideInheritedOptions
+ completion:^(BOOL finished) { [transitionContext completeTransition:finished]; }];
}
else
{
@@ -530,8 +513,8 @@ - (void)animateTransition:(id )transitionC
toView.alpha = 0;
[UIView animateWithDuration:_duration delay:0 options:UIViewAnimationOptionCurveEaseOut
- animations:^{ toView.alpha = alpha;}
- completion:^(BOOL finished) { [transitionContext completeTransition:finished];}];
+ animations:^{ toView.alpha = alpha;}
+ completion:^(BOOL finished) { [transitionContext completeTransition:finished];}];
}
}
@@ -554,7 +537,7 @@ @implementation SWRevealViewControllerPanGestureRecognizer
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
-
+
UITouch *touch = [touches anyObject];
_beginPoint = [touch locationInView:self.view];
_dragging = NO;
@@ -568,13 +551,13 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
if ( _dragging || self.state == UIGestureRecognizerStateFailed)
return;
- const CGFloat kDirectionPanThreshold = 5;
+ const int kDirectionPanThreshold = 5;
UITouch *touch = [touches anyObject];
CGPoint nowPoint = [touch locationInView:self.view];
- if (ABS(nowPoint.x - _beginPoint.x) > kDirectionPanThreshold) _dragging = YES;
- else if (ABS(nowPoint.y - _beginPoint.y) > kDirectionPanThreshold) self.state = UIGestureRecognizerStateFailed;
+ if (fabs(nowPoint.x - _beginPoint.x) > kDirectionPanThreshold) _dragging = YES;
+ else if (fabs(nowPoint.y - _beginPoint.y) > kDirectionPanThreshold) self.state = UIGestureRecognizerStateFailed;
}
@end
@@ -615,7 +598,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder
if ( self )
{
[self _initDefaultProperties];
- }
+ }
return self;
}
@@ -709,7 +692,7 @@ - (void)loadView
// On iOS7 the applicationFrame does not return the whole screen. This is possibly a bug.
// As a workaround we use the screen bounds, this still works on iOS6, any zero based frame would work anyway!
CGRect frame = [[UIScreen mainScreen] bounds];
-
+
// create a custom content view for the controller
_contentView = [[SWRevealView alloc] initWithFrame:frame controller:self];
@@ -718,7 +701,7 @@ - (void)loadView
// set the content view to clip its bounds if requested
[_contentView setClipsToBounds:_clipsViewsToBounds];
-
+
// set our contentView to the controllers view
self.view = _contentView;
@@ -740,7 +723,7 @@ - (void)loadView
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
-
+
// Uncomment the following code if you want the child controllers
// to be loaded at this point.
//
@@ -751,10 +734,10 @@ - (void)viewDidAppear:(BOOL)animated
// If you need to manipulate views of any of your child controllers in an override
// of this method, you can load yourself the views explicitly on your overriden method.
// However we discourage it as an app following the MVC principles should never need to do so
-
-// [_frontViewController view];
-// [_rearViewController view];
-
+
+ // [_frontViewController view];
+ // [_rearViewController view];
+
// we store at this point the view's user interaction state as we may temporarily disable it
// and resume it back to the previous state, it is possible to override this behaviour by
// intercepting it on the panGestureBegan and panGestureEnded delegates
@@ -762,14 +745,18 @@ - (void)viewDidAppear:(BOOL)animated
}
-- (NSUInteger)supportedInterfaceOrientations
-{
- // we could have simply not implemented this, but we choose to call super to make explicit that we
- // want the default behavior.
+//- (NSUInteger)supportedInterfaceOrientations
+//{
+// // we could have simply not implemented this, but we choose to call super to make explicit that we
+// // want the default behavior.
+// return [super supportedInterfaceOrientations];
+//}
+
+
+-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
return [super supportedInterfaceOrientations];
}
-
#pragma mark - Public methods and property accessors
- (void)setFrontViewController:(UIViewController *)frontViewController
@@ -815,7 +802,7 @@ - (void)setRearViewController:(UIViewController *)rearViewController animated:(B
[self _performTransitionOperation:SWRevealControllerOperationReplaceRearController withViewController:rearViewController animated:NO];
return;
}
-
+
[self _dispatchTransitionOperation:SWRevealControllerOperationReplaceRearController withViewController:rearViewController animated:animated];
}
@@ -833,7 +820,7 @@ - (void)setRightViewController:(UIViewController *)rightViewController animated:
[self _performTransitionOperation:SWRevealControllerOperationReplaceRightController withViewController:rightViewController animated:NO];
return;
}
-
+
[self _dispatchTransitionOperation:SWRevealControllerOperationReplaceRightController withViewController:rightViewController animated:animated];
}
@@ -923,7 +910,7 @@ - (UITapGestureRecognizer*)tapGestureRecognizer
if ( _tapGestureRecognizer == nil )
{
UITapGestureRecognizer *tapRecognizer =
- [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_handleTapGesture:)];
+ [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_handleTapGesture:)];
tapRecognizer.delegate = self;
[_contentView.frontView addGestureRecognizer:tapRecognizer];
@@ -944,13 +931,13 @@ - (void)setClipsViewsToBounds:(BOOL)clipsViewsToBounds
#pragma mark - Provided acction methods
- (IBAction)revealToggle:(id)sender
-{
+{
[self revealToggleAnimated:YES];
}
- (IBAction)rightRevealToggle:(id)sender
-{
+{
[self rightRevealToggleAnimated:YES];
}
@@ -1044,7 +1031,7 @@ - (void)_getDragLocationx:(CGFloat*)xLocation progress:(CGFloat*)progress
{
UIView *frontView = _contentView.frontView;
*xLocation = frontView.frame.origin.x;
-
+
int symetry = *xLocation<0 ? -1 : 1;
CGFloat xWidth = symetry < 0 ? _rightViewRevealWidth : _rearViewRevealWidth;
@@ -1057,7 +1044,7 @@ - (void)_getDragLocation:(CGFloat*)xLocation progress:(CGFloat*)progress overdra
{
UIView *frontView = _contentView.frontView;
*xLocation = frontView.frame.origin.x;
-
+
int symetry = *xLocation<0 ? -1 : 1;
CGFloat xWidth = symetry < 0 ? _rightViewRevealWidth : _rearViewRevealWidth;
@@ -1088,11 +1075,11 @@ - (void)_enqueueBlock:(void (^)(void))block
// Removes the top most block in the queue and executes the following one if any.
// Calls to this method must be paired with calls to _enqueueBlock, particularly it may be called
-// from within a block passed to _enqueueBlock to remove itself when done with animations.
+// from within a block passed to _enqueueBlock to remove itself when done with animations.
- (void)_dequeue
{
[_animationQueue removeLastObject];
-
+
if ( _animationQueue.count > 0 )
{
void (^block)(void) = [_animationQueue lastObject];
@@ -1114,7 +1101,7 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)recognizer
if ( recognizer == _tapGestureRecognizer )
return [self _tapGestureShouldBegin];
}
-
+
return NO;
}
@@ -1143,7 +1130,7 @@ - (BOOL)_tapGestureShouldBegin
if ( _frontViewPosition == FrontViewPositionLeft ||
_frontViewPosition == FrontViewPositionRightMostRemoved ||
_frontViewPosition == FrontViewPositionLeftSideMostRemoved )
- return NO;
+ return NO;
// forbid gesture if the following delegate is implemented and returns NO
if ( [_delegate respondsToSelector:@selector(revealControllerTapGestureShouldBegin:)] )
@@ -1159,27 +1146,27 @@ - (BOOL)_panGestureShouldBegin
// forbid gesture if the initial translation is not horizontal
UIView *recognizerView = _panGestureRecognizer.view;
CGPoint translation = [_panGestureRecognizer translationInView:recognizerView];
-// NSLog( @"translation:%@", NSStringFromCGPoint(translation) );
-// if ( fabs(translation.y/translation.x) > 1 )
-// return NO;
-
+ // NSLog( @"translation:%@", NSStringFromCGPoint(translation) );
+ // if ( fabs(translation.y/translation.x) > 1 )
+ // return NO;
+
// forbid gesture if the following delegate is implemented and returns NO
if ( [_delegate respondsToSelector:@selector(revealControllerPanGestureShouldBegin:)] )
if ( [_delegate revealControllerPanGestureShouldBegin:self] == NO )
return NO;
-
+
CGFloat xLocation = [_panGestureRecognizer locationInView:recognizerView].x;
CGFloat width = recognizerView.bounds.size.width;
BOOL draggableBorderAllowing = (
- /*_frontViewPosition != FrontViewPositionLeft ||*/ _draggableBorderWidth == 0.0f ||
- (_rearViewController && xLocation <= _draggableBorderWidth) ||
- (_rightViewController && xLocation >= (width - _draggableBorderWidth)) );
+ /*_frontViewPosition != FrontViewPositionLeft ||*/ _draggableBorderWidth == 0.0f ||
+ (_rearViewController && xLocation <= _draggableBorderWidth) ||
+ (_rightViewController && xLocation >= (width - _draggableBorderWidth)) );
BOOL translationForbidding = ( _frontViewPosition == FrontViewPositionLeft &&
- ((_rearViewController == nil && translation.x > 0) || (_rightViewController == nil && translation.x < 0)) );
-
+ ((_rearViewController == nil && translation.x > 0) || (_rightViewController == nil && translation.x < 0)) );
+
// allow gesture only within the bounds defined by the draggableBorderWidth property
return draggableBorderAllowing && !translationForbidding ;
}
@@ -1211,7 +1198,7 @@ - (void)_handleRevealGesture:(UIPanGestureRecognizer *)recognizer
break;
case UIGestureRecognizerStateCancelled:
- //case UIGestureRecognizerStateFailed:
+ //case UIGestureRecognizerStateFailed:
[self _handleRevealGestureStateCancelledWithRecognizer:recognizer];
break;
@@ -1228,10 +1215,10 @@ - (void)_handleRevealGestureStateBeganWithRecognizer:(UIPanGestureRecognizer *)r
// the gesture, so we just enqueue a dummy block to ensure any programatic acctions will be
// scheduled after the gesture is completed
[self _enqueueBlock:^{}]; // <-- dummy block
-
+
// we store the initial position and initialize a target position
_panInitialFrontPosition = _frontViewPosition;
-
+
// we disable user interactions on the views, however programatic accions will still be
// enqueued to be performed after the gesture completes
[self _disableUserInteraction];
@@ -1291,9 +1278,9 @@ - (void)_handleRevealGestureStateEndedWithRecognizer:(UIPanGestureRecognizer *)r
// initially we assume drag to left and default duration
FrontViewPosition frontViewPosition = FrontViewPositionLeft;
NSTimeInterval duration = _toggleAnimationDuration;
-
+
// Velocity driven change:
- if (ABS(velocity) > _quickFlickVelocity)
+ if (fabs(velocity) > _quickFlickVelocity)
{
// we may need to set the drag position and to adjust the animation duration
CGFloat journey = xLocation;
@@ -1311,13 +1298,13 @@ - (void)_handleRevealGestureStateEndedWithRecognizer:(UIPanGestureRecognizer *)r
}
}
- duration = ABS(journey/velocity);
+ duration = fabs(journey/velocity);
}
// Position driven change:
else
- {
- // we may need to set the drag position
+ {
+ // we may need to set the drag position
if (xLocation > revealWidth*0.5f)
{
frontViewPosition = FrontViewPositionRight;
@@ -1325,7 +1312,7 @@ - (void)_handleRevealGestureStateEndedWithRecognizer:(UIPanGestureRecognizer *)r
{
if (bounceBack)
frontViewPosition = FrontViewPositionLeft;
-
+
else if (stableDrag && xLocation > revealWidth+revealOverdraw*0.5f)
frontViewPosition = FrontViewPositionRightMost;
}
@@ -1343,7 +1330,7 @@ - (void)_handleRevealGestureStateEndedWithRecognizer:(UIPanGestureRecognizer *)r
- (void)_handleRevealGestureStateCancelledWithRecognizer:(UIPanGestureRecognizer *)recognizer
-{
+{
[self _restoreUserInteraction];
[self _notifyPanGestureEnded];
[self _dequeue];
@@ -1368,7 +1355,7 @@ - (void)_dispatchPushFrontViewController:(UIViewController *)newFrontViewControl
NSTimeInterval duration = animated?_toggleAnimationDuration:0.0;
NSTimeInterval firstDuration = duration;
- NSInteger initialPosDif = ABS( _frontViewPosition - preReplacementPosition );
+ long initialPosDif = labs( _frontViewPosition - preReplacementPosition );
if ( initialPosDif == 1 ) firstDuration *= 0.8;
else if ( initialPosDif == 0 ) firstDuration = 0;
@@ -1405,12 +1392,13 @@ - (void)_setFrontViewPosition:(FrontViewPosition)newPosition withDuration:(NSTim
void (^animations)() = ^()
{
// Calling this in the animation block causes the status bar to appear/dissapear in sync with our own animation
- [self setNeedsStatusBarAppearanceUpdate];
+ if ( [self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
+ [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate) withObject:nil];
// We call the layoutSubviews method on the contentView view and send a delegate, which will
// occur inside of an animation block if any animated transition is being performed
[_contentView layoutSubviews];
-
+
if ([_delegate respondsToSelector:@selector(revealController:animateToPosition:)])
[_delegate revealController:self animateToPosition:_frontViewPosition];
};
@@ -1428,12 +1416,12 @@ - (void)_setFrontViewPosition:(FrontViewPosition)newPosition withDuration:(NSTim
if ( _toggleAnimationType == SWRevealToggleAnimationTypeEaseOut )
{
[UIView animateWithDuration:duration delay:0.0
- options:UIViewAnimationOptionCurveEaseOut animations:animations completion:completion];
+ options:UIViewAnimationOptionCurveEaseOut animations:animations completion:completion];
}
else
{
[UIView animateWithDuration:_toggleAnimationDuration delay:0.0 usingSpringWithDamping:_springDampingRatio initialSpringVelocity:1/duration
- options:0 animations:animations completion:completion];
+ options:0 animations:animations completion:completion];
}
}
else
@@ -1450,7 +1438,7 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
{
if ( [_delegate respondsToSelector:@selector(revealController:willAddViewController:forOperation:animated:)] )
[_delegate revealController:self willAddViewController:new forOperation:operation animated:animated];
-
+
UIViewController *old = nil;
UIView *view = nil;
@@ -1462,7 +1450,7 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
else if ( operation == SWRevealControllerOperationReplaceRightController )
old = _rightViewController, _rightViewController = new, view = _contentView.rightView;
-
+
void (^completion)() = [self _transitionFromViewController:old toViewController:new inView:view];
void (^animationCompletion)() = ^
@@ -1470,23 +1458,23 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
completion();
if ( [_delegate respondsToSelector:@selector(revealController:didAddViewController:forOperation:animated:)] )
[_delegate revealController:self didAddViewController:new forOperation:operation animated:animated];
-
+
[self _dequeue];
};
if ( animated )
{
id animationController = nil;
-
+
if ( [_delegate respondsToSelector:@selector(revealController:animationControllerForOperation:fromViewController:toViewController:)] )
animationController = [_delegate revealController:self animationControllerForOperation:operation fromViewController:old toViewController:new];
-
+
if ( !animationController )
animationController = [[SWDefaultAnimationController alloc] initWithDuration:_replaceViewAnimationDuration];
-
+
SWContextTransitionObject *transitioningObject = [[SWContextTransitionObject alloc] initWithRevealController:self containerView:view
- fromVC:old toVC:new completion:animationCompletion];
-
+ fromVC:old toVC:new completion:animationCompletion];
+
if ( [animationController transitionDuration:transitioningObject] > 0 )
[animationController animateTransition:transitioningObject];
else
@@ -1506,18 +1494,18 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
- (void (^)(void))_frontViewDeploymentForNewFrontViewPosition:(FrontViewPosition)newPosition
{
if ( (_rightViewController == nil && newPosition < FrontViewPositionLeft) ||
- (_rearViewController == nil && newPosition > FrontViewPositionLeft) )
+ (_rearViewController == nil && newPosition > FrontViewPositionLeft) )
newPosition = FrontViewPositionLeft;
BOOL positionIsChanging = (_frontViewPosition != newPosition);
BOOL appear =
- (_frontViewPosition >= FrontViewPositionRightMostRemoved || _frontViewPosition <= FrontViewPositionLeftSideMostRemoved || _frontViewPosition == FrontViewPositionNone) &&
- (newPosition < FrontViewPositionRightMostRemoved && newPosition > FrontViewPositionLeftSideMostRemoved);
+ (_frontViewPosition >= FrontViewPositionRightMostRemoved || _frontViewPosition <= FrontViewPositionLeftSideMostRemoved || _frontViewPosition == FrontViewPositionNone) &&
+ (newPosition < FrontViewPositionRightMostRemoved && newPosition > FrontViewPositionLeftSideMostRemoved);
BOOL disappear =
- (newPosition >= FrontViewPositionRightMostRemoved || newPosition <= FrontViewPositionLeftSideMostRemoved ) &&
- (_frontViewPosition < FrontViewPositionRightMostRemoved && _frontViewPosition > FrontViewPositionLeftSideMostRemoved && _frontViewPosition != FrontViewPositionNone);
+ (newPosition >= FrontViewPositionRightMostRemoved || newPosition <= FrontViewPositionLeftSideMostRemoved ) &&
+ (_frontViewPosition < FrontViewPositionRightMostRemoved && _frontViewPosition > FrontViewPositionLeftSideMostRemoved && _frontViewPosition != FrontViewPositionNone);
if ( positionIsChanging )
{
@@ -1528,7 +1516,7 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
_frontViewPosition = newPosition;
void (^deploymentCompletion)() =
- [self _deploymentForViewController:_frontViewController inView:_contentView.frontView appear:appear disappear:disappear];
+ [self _deploymentForViewController:_frontViewController inView:_contentView.frontView appear:appear disappear:disappear];
void (^completion)() = ^()
{
@@ -1539,7 +1527,7 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
[_delegate revealController:self didMoveToPosition:newPosition];
}
};
-
+
return completion;
}
@@ -1552,7 +1540,7 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
if ( _rearViewController == nil && newPosition > FrontViewPositionLeft )
newPosition = FrontViewPositionLeft;
-
+
BOOL appear = (_rearViewPosition <= FrontViewPositionLeft || _rearViewPosition == FrontViewPositionNone) && newPosition > FrontViewPositionLeft;
BOOL disappear = newPosition <= FrontViewPositionLeft && (_rearViewPosition > FrontViewPositionLeft && _rearViewPosition != FrontViewPositionNone);
@@ -1561,17 +1549,7 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
_rearViewPosition = newPosition;
- void (^deploymentCompletion)() =
- [self _deploymentForViewController:_rearViewController inView:_contentView.rearView appear:appear disappear:disappear];
-
- void (^completion)() = ^()
- {
- deploymentCompletion();
- if ( disappear )
- [_contentView unloadRearView];
- };
-
- return completion;
+ return [self _deploymentForViewController:_rearViewController inView:_contentView.rearView appear:appear disappear:disappear];
}
// Deploy/Undeploy of the right view controller following the containment principles. Returns a block
@@ -1580,7 +1558,7 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
{
if ( _rightViewController == nil && newPosition < FrontViewPositionLeft )
newPosition = FrontViewPositionLeft;
-
+
BOOL appear = (_rightViewPosition >= FrontViewPositionLeft || _rightViewPosition == FrontViewPositionNone) && newPosition < FrontViewPositionLeft ;
BOOL disappear = newPosition >= FrontViewPositionLeft && (_rightViewPosition < FrontViewPositionLeft && _rightViewPosition != FrontViewPositionNone);
@@ -1589,17 +1567,7 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
_rightViewPosition = newPosition;
- void (^deploymentCompletion)() =
- [self _deploymentForViewController:_rightViewController inView:_contentView.rightView appear:appear disappear:disappear];
-
- void (^completion)() = ^()
- {
- deploymentCompletion();
- if ( disappear )
- [_contentView unloadRightView];
- };
-
- return completion;
+ return [self _deploymentForViewController:_rightViewController inView:_contentView.rightView appear:appear disappear:disappear];
}
@@ -1626,9 +1594,9 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
controllerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
controllerView.frame = frame;
- if ( [controllerView isKindOfClass:[UIScrollView class]] )
+ if ( [controller respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)] && [controllerView isKindOfClass:[UIScrollView class]] )
{
- BOOL adjust = controller.automaticallyAdjustsScrollViewInsets;
+ BOOL adjust = (BOOL)[controller performSelector:@selector(automaticallyAdjustsScrollViewInsets) withObject:nil];
if ( adjust )
{
@@ -1652,7 +1620,7 @@ - (void)_performTransitionOperation:(SWRevealControllerOperation)operation withV
{
if (!controller)
return ^(void){};
-
+
// nothing to do before completion at this stage
void (^completionBlock)(void) = ^(void)
@@ -1798,7 +1766,7 @@ - (void)decodeRestorableStateWithCoder:(NSCoder *)coder
_draggableBorderWidth = [coder decodeDoubleForKey:@"_draggableBorderWidth"];
_clipsViewsToBounds = [coder decodeBoolForKey:@"_clipsViewsToBounds"];
_extendsPointInsideHit = [coder decodeBoolForKey:@"_extendsPointInsideHit"];
-
+
[self setRearViewController:[coder decodeObjectForKey:@"_rearViewController"]];
[self setFrontViewController:[coder decodeObjectForKey:@"_frontViewController"]];
[self setRightViewController:[coder decodeObjectForKey:@"_rightViewController"]];
@@ -1903,7 +1871,7 @@ - (void)perform
//{
// // This method is required for compatibility with SWRevealViewControllerSegue, now deprecated.
// // It can be simply removed when using SWRevealViewControllerSegueSetController and SWRevealViewControlerSeguePushController
-//
+//
// NSString *identifier = segue.identifier;
// if ( [segue isKindOfClass:[SWRevealViewControllerSegue class]] && sender == nil )
// {