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

Remove older code and fix all build warnings #204

Open
wants to merge 6 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
13 changes: 13 additions & 0 deletions JASidePanels.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Pod::Spec.new do |s|
s.name = 'JASidePanels'
s.version = '1.3.2'
s.license = { :type => 'MIT', :file => 'README.markdown' }
s.summary = 'UIViewController container designed for presenting a center panel with revealable side panels - one to the left and one to the right.'
s.homepage = 'https://github.com/gotosleep/JASidePanels'
s.author = { 'Jesse Andersen' => '[email protected]' }
s.source = { :git => 'https://github.com/gotosleep/JASidePanels.git', :tag => '1.3.2' }
s.platform = :ios, '5.0'
s.source_files = 'JASidePanels/Source/*'
s.framework = 'QuartzCore'
s.requires_arc = true
end
64 changes: 16 additions & 48 deletions JASidePanels/Source/JASidePanelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,28 +192,6 @@ - (void)viewDidAppear:(BOOL)animated{
[self _adjustCenterFrame]; //Account for possible rotation while view appearing
}

#if !defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0

- (void)viewDidUnload {
[super viewDidUnload];
self.tapView = nil;
self.centerPanelContainer = nil;
self.leftPanelContainer = nil;
self.rightPanelContainer = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
__strong UIViewController *visiblePanel = self.visiblePanel;

if (self.shouldDelegateAutorotateToVisiblePanel) {
return [visiblePanel shouldAutorotateToInterfaceOrientation:toInterfaceOrientation];
} else {
return YES;
}
}

#else

- (BOOL)shouldAutorotate {
__strong UIViewController *visiblePanel = self.visiblePanel;

Expand All @@ -224,19 +202,11 @@ - (BOOL)shouldAutorotate {
}
}


#endif

- (void)willAnimateRotationToInterfaceOrientation:(__unused UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
self.centerPanelContainer.frame = [self _adjustCenterFrame];
[self _layoutSideContainers:YES duration:duration];
[self _layoutSidePanels];
[self styleContainer:self.centerPanelContainer animate:YES duration:duration];
if (self.centerPanelHidden) {
CGRect frame = self.centerPanelContainer.frame;
frame.origin.x = self.state == JASidePanelLeftVisible ? self.centerPanelContainer.frame.size.width : -self.centerPanelContainer.frame.size.width;
self.centerPanelContainer.frame = frame;
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
dispatch_async(dispatch_get_main_queue(), ^{
[self styleContainer:self.centerPanelContainer animate:YES duration:0];
});
}

#pragma mark - State
Expand Down Expand Up @@ -370,11 +340,11 @@ - (void)setCenterPanel:(UIViewController *)centerPanel {
if (self.bounceOnCenterPanelChange) {
// first move the centerPanel offscreen
CGFloat x = (previousState == JASidePanelLeftVisible) ? self.view.bounds.size.width : -self.view.bounds.size.width;
_centerPanelRestingFrame.origin.x = x;
self->_centerPanelRestingFrame.origin.x = x;
}
self.centerPanelContainer.frame = _centerPanelRestingFrame;
self.centerPanelContainer.frame = self->_centerPanelRestingFrame;
} completion:^(__unused BOOL finished) {
[self _swapCenter:previous previousState:previousState with:_centerPanel];
[self _swapCenter:previous previousState:previousState with:self->_centerPanel];
[self _showCenterPanel:YES bounce:NO];
}];
}
Expand Down Expand Up @@ -463,7 +433,7 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
if (translate.x > 0 && ! self.allowLeftSwipe) {
return NO;
}
BOOL possible = translate.x != 0 && ((fabsf(translate.y) / fabsf(translate.x)) < 1.0f);
BOOL possible = translate.x != 0 && ((fabs(translate.y) / fabs(translate.x)) < 1.0f);
if (possible && ((translate.x > 0 && self.leftPanel) || (translate.x < 0 && self.rightPanel))) {
return YES;
}
Expand Down Expand Up @@ -609,8 +579,6 @@ - (CGFloat)_correctMovement:(CGFloat)movement {
} else if (self.state == JASidePanelRightVisible && !self.allowRightOverpan) {
if (position < -self.rightVisibleWidth) {
return 0.0f;
} else if ((self.style == JASidePanelMultipleActive || self.pushesSidePanels) && position > 0.0f) {
return -_centerPanelRestingFrame.origin.x;
} else if (position > self.rightPanelContainer.frame.origin.x) {
return self.rightPanelContainer.frame.origin.x - _centerPanelRestingFrame.origin.x;
}
Expand All @@ -633,7 +601,7 @@ - (BOOL)_validateThreshold:(CGFloat)movement {
return movement <= -minimum;
}
case JASidePanelCenterVisible: {
return fabsf(movement) >= minimum;
return fabs(movement) >= minimum;
}
case JASidePanelRightVisible: {
return movement >= minimum;
Expand Down Expand Up @@ -726,8 +694,8 @@ - (void)_unloadPanels {
#pragma mark - Animation

- (CGFloat)_calculatedDuration {
CGFloat remaining = fabsf(self.centerPanelContainer.frame.origin.x - _centerPanelRestingFrame.origin.x);
CGFloat max = _locationBeforePan.x == _centerPanelRestingFrame.origin.x ? remaining : fabsf(_locationBeforePan.x - _centerPanelRestingFrame.origin.x);
CGFloat remaining = fabs(self.centerPanelContainer.frame.origin.x - _centerPanelRestingFrame.origin.x);
CGFloat max = _locationBeforePan.x == _centerPanelRestingFrame.origin.x ? remaining : fabs(_locationBeforePan.x - _centerPanelRestingFrame.origin.x);
return max > 0.0f ? self.maximumAnimationDuration * (remaining / max) : self.maximumAnimationDuration;
}

Expand All @@ -741,7 +709,7 @@ - (void)_animateCenterPanel:(BOOL)shouldBounce completion:(void (^)(BOOL finishe

CGFloat duration = [self _calculatedDuration];
[UIView animateWithDuration:duration delay:0.0f options:UIViewAnimationOptionCurveLinear|UIViewAnimationOptionLayoutSubviews animations:^{
self.centerPanelContainer.frame = _centerPanelRestingFrame;
self.centerPanelContainer.frame = self->_centerPanelRestingFrame;
[self styleContainer:self.centerPanelContainer animate:YES duration:duration];
if (self.style == JASidePanelMultipleActive || self.pushesSidePanels) {
[self _layoutSideContainers:NO duration:0.0f];
Expand All @@ -758,12 +726,12 @@ - (void)_animateCenterPanel:(BOOL)shouldBounce completion:(void (^)(BOOL finishe
}
// animate the bounce
[UIView animateWithDuration:self.bounceDuration delay:0.0f options:UIViewAnimationOptionCurveEaseOut animations:^{
CGRect bounceFrame = _centerPanelRestingFrame;
CGRect bounceFrame = self->_centerPanelRestingFrame;
bounceFrame.origin.x += bounceDistance;
self.centerPanelContainer.frame = bounceFrame;
} completion:^(__unused BOOL finished2) {
[UIView animateWithDuration:self.bounceDuration delay:0.0f options:UIViewAnimationOptionCurveEaseIn animations:^{
self.centerPanelContainer.frame = _centerPanelRestingFrame;
self.centerPanelContainer.frame = self->_centerPanelRestingFrame;
} completion:completion];
}];
} else if (completion) {
Expand Down Expand Up @@ -1020,7 +988,7 @@ - (void)setCenterPanelHidden:(BOOL)centerPanelHidden animated:(BOOL)animated dur
}
} completion:^(__unused BOOL finished) {
// need to double check in case the user tapped really fast
if (_centerPanelHidden) {
if (self->_centerPanelHidden) {
[self _hideCenterPanel];
}
}];
Expand Down