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

Option for non-rounded corners #184

Open
wants to merge 3 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions JASidePanels/Source/JASidePanelController.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ typedef enum _JASidePanelState {
// while changing the center panel, should we bounce it offscreen?
@property (nonatomic) BOOL bounceOnCenterPanelChange; // defaults to YES

// use rounded corners on panels
@property (nonatomic) BOOL roundPanelCorners; // defaults to YES

#pragma mark - Gesture Behavior

// Determines whether the pan gesture is limited to the top ViewController in a UINavigationController/UITabBarController
Expand Down Expand Up @@ -168,4 +171,6 @@ typedef enum _JASidePanelState {
@property (nonatomic, strong, readonly) UIView *rightPanelContainer;
@property (nonatomic, strong, readonly) UIView *centerPanelContainer;

extern NSString* JASidePanelControllerWillShowLeftPanel;

@end
21 changes: 17 additions & 4 deletions JASidePanels/Source/JASidePanelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ @implementation JASidePanelController
@synthesize allowLeftSwipe = _allowLeftSwipe;
@synthesize allowRightSwipe = _allowRightSwipe;
@synthesize pushesSidePanels = _pushesSidePanels;
@synthesize roundPanelCorners = _roundPanelCorners;

NSString* JASidePanelControllerWillShowLeftPanel = @"JASidePanelControllerWillShowLeftPanel";

#pragma mark - Icon

Expand Down Expand Up @@ -148,6 +151,7 @@ - (void)_baseInit {
self.shouldDelegateAutorotateToVisiblePanel = YES;
self.allowRightSwipe = YES;
self.allowLeftSwipe = YES;
self.roundPanelCorners = YES;
}

#pragma mark - UIViewController
Expand Down Expand Up @@ -681,7 +685,9 @@ - (void)_loadCenterPanelWithPreviousState:(JASidePanelState)previousState {

_centerPanel.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_centerPanel.view.frame = self.centerPanelContainer.bounds;
[self stylePanel:_centerPanel.view];
if (self.roundPanelCorners) {
[self stylePanel:_centerPanel.view];
}
}

- (void)_loadLeftPanel {
Expand All @@ -691,7 +697,9 @@ - (void)_loadLeftPanel {
if (!_leftPanel.view.superview) {
[self _layoutSidePanels];
_leftPanel.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self stylePanel:_leftPanel.view];
if (self.roundPanelCorners) {
[self stylePanel:_leftPanel.view];
}
[self.leftPanelContainer addSubview:_leftPanel.view];
}

Expand All @@ -706,7 +714,9 @@ - (void)_loadRightPanel {
if (!_rightPanel.view.superview) {
[self _layoutSidePanels];
_rightPanel.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self stylePanel:_rightPanel.view];
if (self.roundPanelCorners) {
[self stylePanel:_rightPanel.view];
}
[self.rightPanelContainer addSubview:_rightPanel.view];
}

Expand Down Expand Up @@ -823,6 +833,7 @@ - (CGFloat)rightVisibleWidth {
#pragma mark - Showing Panels

- (void)_showLeftPanel:(BOOL)animated bounce:(BOOL)shouldBounce {
[[NSNotificationCenter defaultCenter] postNotificationName:JASidePanelControllerWillShowLeftPanel object:nil];
self.state = JASidePanelLeftVisible;
[self _loadLeftPanel];

Expand Down Expand Up @@ -904,7 +915,9 @@ - (void)_unhideCenterPanel {
if (!self.centerPanel.view.superview) {
self.centerPanel.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.centerPanel.view.frame = self.centerPanelContainer.bounds;
[self stylePanel:self.centerPanel.view];
if (self.roundPanelCorners) {
[self stylePanel:self.centerPanel.view];
}
[self.centerPanelContainer addSubview:self.centerPanel.view];
}
}
Expand Down
1 change: 1 addition & 0 deletions JASidePanels/Source/UIViewController+JASidePanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class JASidePanelController;

Expand Down