├── CQSideBarManager.podspec ├── CQSideBarManager ├── CQSideBarConst.h ├── CQSideBarConst.m ├── CQSideBarManager.h ├── CQSideBarManager.m ├── UIView+CQExtension.h └── UIView+CQExtension.m ├── CQSideBarManagerExample ├── CQSideBarManagerExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── CQSideBarManagerExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── SideBarViewController.h │ ├── SideBarViewController.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── LICENSE ├── README.md └── 演示项目.gif /CQSideBarManager.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "CQSideBarManager" 4 | s.version = "0.1.2" 5 | s.summary = "A useful sideBar Manager for iOS." 6 | s.homepage = "https://github.com/heartjoy/CQSideBarManager" 7 | s.license = "MIT" 8 | s.author = { "heartjoy" => "xinzhongdefuping@163.com" } 9 | s.platform = :ios, "7.0" 10 | s.source = { :git => "https://github.com/heartjoy/CQSideBarManager.git", :tag => s.version } 11 | s.source_files = "CQSideBarManager", "CQSideBarManager/**/*.{h,m}" 12 | s.requires_arc = true 13 | 14 | end 15 | -------------------------------------------------------------------------------- /CQSideBarManager/CQSideBarConst.h: -------------------------------------------------------------------------------- 1 | // 2 | // CQSideBarConst.h 3 | // CQSideBarManager 4 | // 5 | // Created by heartjoy on 2017/3/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIView+CQExtension.h" 11 | 12 | #define SIDEBAR_START_POINT CGPointMake(35.f, 0.f) 13 | 14 | #define SIDEBAR_ANIMATE_DURATION 0.25f 15 | 16 | #define SIDEBAR_COLOR(r,g,b,a) [UIColor colorWithRed:(r/255.0) green:(g/255.0) blue:(b/255.0) alpha:a] 17 | #define SIDEBAR_RANDOM_COLOR SIDEBAR_COLOR(arc4random_uniform(256),arc4random_uniform(256),arc4random_uniform(256),1) 18 | 19 | #define SIDEBAR_SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width 20 | #define SIDEBAR_SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height 21 | 22 | #define SIDEBAR_KEY_WINDOW [UIApplication sharedApplication].keyWindow 23 | 24 | UIKIT_EXTERN NSString *const CQSideBarOpenErrorText; 25 | -------------------------------------------------------------------------------- /CQSideBarManager/CQSideBarConst.m: -------------------------------------------------------------------------------- 1 | // 2 | // CQSideBarConst.m 3 | // CQSideBarManager 4 | // 5 | // Created by heartjoy on 2017/3/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NSString *const CQSideBarOpenErrorText = @"调用openSideBarView方法前必须实现viewForSideBarView代理方法"; 12 | 13 | -------------------------------------------------------------------------------- /CQSideBarManager/CQSideBarManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // CQSideBarManager.h 3 | // CQSideBarManager 4 | // 5 | // Created by heartjoy on 2017/3/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CQSideBarConst.h" 11 | 12 | @protocol CQSideBarManagerDelegate 13 | 14 | @required 15 | 16 | /** 17 | * 侧边栏里面的具体View 18 | */ 19 | - (UIView *)viewForSideBar; 20 | 21 | @optional 22 | 23 | /** 24 | * 点击阴影是否关闭侧边栏(默认为可关闭) 25 | 26 | */ 27 | - (BOOL)canCloseSideBar; 28 | 29 | @end 30 | 31 | @interface CQSideBarManager : NSObject 32 | 33 | /** 34 | * 侧边栏开始显示位置(默认为(35,0)) 35 | */ 36 | @property (nonatomic, assign) CGPoint startOffsetPoint; 37 | 38 | + (instancetype)sharedInstance; 39 | 40 | /** 41 | * 获取侧边栏的具体view 42 | */ 43 | - (UIView *)viewInSideSideBar; 44 | 45 | /** 46 | * 打开侧边栏 47 | */ 48 | - (void)openSideBar:(id)delegate; 49 | 50 | /** 51 | * 关闭侧边栏 52 | */ 53 | - (void)closeSideBar; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /CQSideBarManager/CQSideBarManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // CQSideBarManager.m 3 | // CQSideBarManager 4 | // 5 | // Created by heartjoy on 2017/3/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import "CQSideBarManager.h" 10 | 11 | @interface CQSideBarManager () 12 | { 13 | UIView *_contentView; 14 | } 15 | 16 | @property (nonatomic, strong) UIWindow *currentWindow; 17 | @property (nonatomic, strong) UIView *shadeView; 18 | @property (nonatomic, strong) UITapGestureRecognizer *tapGestureRecognizer; 19 | @property (nonatomic, assign) BOOL canCloseSideBar; 20 | /** 21 | * 侧边栏结束显示位置(默认为(屏幕宽,0)) 22 | */ 23 | @property (nonatomic, assign) CGPoint endOffsetPoint; 24 | 25 | @property (nonatomic, weak) id delegate; 26 | 27 | @end 28 | 29 | @implementation CQSideBarManager 30 | 31 | + (instancetype)sharedInstance 32 | { 33 | static id instance = nil; 34 | static dispatch_once_t onceToken; 35 | dispatch_once(&onceToken, ^{ 36 | instance = [[self alloc] init]; 37 | }); 38 | return instance; 39 | } 40 | 41 | - (instancetype)init 42 | { 43 | self = [super init]; 44 | if (self) { 45 | [self commonInit]; 46 | } 47 | return self; 48 | } 49 | 50 | - (void)commonInit 51 | { 52 | _currentWindow = SIDEBAR_KEY_WINDOW; 53 | _startOffsetPoint = SIDEBAR_START_POINT; 54 | _endOffsetPoint = CGPointMake(_currentWindow.cq_width, 0); 55 | } 56 | 57 | /* 58 | * 设备方向改变的处理 59 | */ 60 | - (void)handleDeviceOrientationChange:(NSNotification *)notification 61 | { 62 | _shadeView.frame = _currentWindow.frame; 63 | _contentView.frame = CGRectMake(_startOffsetPoint.x, _startOffsetPoint.y, _currentWindow.cq_width - _startOffsetPoint.x, _currentWindow.cq_height - _startOffsetPoint.y); 64 | } 65 | 66 | - (void)openSideBar:(id)delegate 67 | { 68 | _delegate = delegate; 69 | _contentView = nil; 70 | 71 | if (!_shadeView) { 72 | _shadeView = [[UIView alloc] initWithFrame:_currentWindow.frame]; 73 | _shadeView.backgroundColor = SIDEBAR_COLOR(0, 0, 0, 0.5f); 74 | } 75 | [_currentWindow addSubview:_shadeView]; 76 | 77 | self.canCloseSideBar = YES; 78 | 79 | if (_delegate) { 80 | if ([_delegate respondsToSelector:@selector(viewForSideBar)]) { 81 | _contentView = [self.delegate viewForSideBar]; 82 | /* 83 | * 重置设置抽屉视图的初始位置 84 | */ 85 | _contentView.cq_x = _currentWindow.cq_width; 86 | } 87 | 88 | if ([_delegate respondsToSelector:@selector(canCloseSideBar)]) { 89 | self.canCloseSideBar = [self.delegate canCloseSideBar]; 90 | } 91 | 92 | NSAssert(_contentView != nil, CQSideBarOpenErrorText); 93 | } 94 | 95 | [_currentWindow addSubview:_contentView]; 96 | 97 | [self openAnimation]; 98 | 99 | } 100 | 101 | - (void)closeSideBar 102 | { 103 | if (_contentView) { 104 | [self closeAnimation]; 105 | } 106 | } 107 | 108 | - (void)openAnimation 109 | { 110 | [UIView animateWithDuration:SIDEBAR_ANIMATE_DURATION animations:^{ 111 | _contentView.frame = CGRectMake(_startOffsetPoint.x, _startOffsetPoint.y, _currentWindow.cq_width - _startOffsetPoint.x, _currentWindow.cq_height - _startOffsetPoint.y); 112 | }]; 113 | 114 | [self addObserverDeviceOrientationNotification]; 115 | } 116 | 117 | - (void)closeAnimation 118 | { 119 | [UIView animateWithDuration:SIDEBAR_ANIMATE_DURATION animations:^{ 120 | _contentView.frame = CGRectMake(_endOffsetPoint.x, _endOffsetPoint.y,_currentWindow.cq_width, _currentWindow.cq_height); 121 | } completion:^(BOOL finished) { 122 | 123 | [_shadeView removeFromSuperview]; 124 | [_contentView removeFromSuperview]; 125 | 126 | [self removeObserverDeviceOrientationNotification]; 127 | 128 | _shadeView = nil; 129 | _contentView = nil; 130 | _delegate = nil; 131 | 132 | }]; 133 | } 134 | 135 | - (void)addObserverDeviceOrientationNotification 136 | { 137 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDeviceOrientationChange:) name:UIDeviceOrientationDidChangeNotification object:nil]; 138 | } 139 | 140 | - (void)removeObserverDeviceOrientationNotification 141 | { 142 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; 143 | } 144 | 145 | #pragma mark -----Getter 146 | - (UIView *)viewInSideSideBar 147 | { 148 | return _contentView; 149 | } 150 | 151 | - (UITapGestureRecognizer *)tapGestureRecognizer 152 | { 153 | if (!_tapGestureRecognizer) { 154 | _tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeSideBar)]; 155 | } 156 | 157 | return _tapGestureRecognizer; 158 | } 159 | 160 | #pragma mark -----Setter 161 | - (void)setCanCloseSideBar:(BOOL)canCloseSideBar 162 | { 163 | _canCloseSideBar = canCloseSideBar; 164 | if (_shadeView) { 165 | if (!_canCloseSideBar) { 166 | [_shadeView removeGestureRecognizer:_tapGestureRecognizer]; 167 | }else { 168 | [_shadeView addGestureRecognizer:self.tapGestureRecognizer]; 169 | } 170 | } 171 | } 172 | 173 | - (void)setStartOffsetPoint:(CGPoint)startOffsetPoint 174 | { 175 | _startOffsetPoint = startOffsetPoint; 176 | } 177 | 178 | @end 179 | -------------------------------------------------------------------------------- /CQSideBarManager/UIView+CQExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+CQExtension.h 3 | // CQSideBarManager 4 | // 5 | // Created by heartjoy on 2017/3/5. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (CQExtension) 12 | 13 | @property (nonatomic, assign) CGFloat cq_x; 14 | @property (nonatomic, assign) CGFloat cq_y; 15 | @property (nonatomic, assign) CGFloat cq_centerX; 16 | @property (nonatomic, assign) CGFloat cq_centerY; 17 | @property (nonatomic, assign) CGFloat cq_width; 18 | @property (nonatomic, assign) CGFloat cq_height; 19 | @property (nonatomic, assign) CGSize cq_size; 20 | @property (nonatomic, assign) CGFloat cq_right; 21 | @property (nonatomic, assign) CGFloat cq_bottom; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CQSideBarManager/UIView+CQExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+CQExtension.m 3 | // CQSideBarManager 4 | // 5 | // Created by heartjoy on 2017/3/5. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import "UIView+CQExtension.h" 10 | 11 | @implementation UIView (CQExtension) 12 | 13 | - (void)setCq_x:(CGFloat)x 14 | { 15 | CGRect frame = self.frame; 16 | frame.origin.x = x; 17 | self.frame = frame; 18 | } 19 | 20 | - (CGFloat)cq_x 21 | { 22 | return self.frame.origin.x; 23 | } 24 | 25 | - (void)setCq_y:(CGFloat)y 26 | { 27 | CGRect frame = self.frame; 28 | frame.origin.y = y; 29 | self.frame = frame; 30 | } 31 | 32 | - (CGFloat)cq_y 33 | { 34 | return self.frame.origin.y; 35 | } 36 | 37 | - (void)setCq_centerX:(CGFloat)centerX 38 | { 39 | CGPoint center = self.center; 40 | center.x = centerX; 41 | self.center = center; 42 | } 43 | 44 | - (CGFloat)cq_centerX 45 | { 46 | return self.center.x; 47 | } 48 | 49 | - (void)setCq_centerY:(CGFloat)centerY 50 | { 51 | CGPoint center = self.center; 52 | center.y = centerY; 53 | self.center = center; 54 | } 55 | 56 | - (CGFloat)cq_centerY 57 | { 58 | return self.center.y; 59 | } 60 | 61 | - (void)setCq_width:(CGFloat)width 62 | { 63 | CGRect frame = self.frame; 64 | frame.size.width = width; 65 | self.frame = frame; 66 | } 67 | 68 | - (CGFloat)cq_width 69 | { 70 | return self.frame.size.width; 71 | } 72 | 73 | - (void)setCq_height:(CGFloat)height 74 | { 75 | CGRect frame = self.frame; 76 | frame.size.height = height; 77 | self.frame = frame; 78 | } 79 | 80 | - (CGFloat)cq_height 81 | { 82 | return self.frame.size.height; 83 | } 84 | 85 | - (void)setCq_size:(CGSize)size 86 | { 87 | CGRect frame = self.frame; 88 | frame.size = size; 89 | self.frame = frame; 90 | } 91 | 92 | - (CGSize)cq_size 93 | { 94 | return self.frame.size; 95 | } 96 | 97 | - (CGFloat)cq_right 98 | { 99 | return self.frame.origin.x + self.frame.size.width; 100 | } 101 | 102 | - (void)setCq_right:(CGFloat)cq_right 103 | { 104 | CGRect frame = self.frame; 105 | frame.origin.x = cq_right - frame.size.width; 106 | self.frame = frame; 107 | } 108 | 109 | - (CGFloat)cq_bottom 110 | { 111 | return self.frame.origin.y + self.frame.size.height; 112 | } 113 | 114 | - (void)setCq_bottom:(CGFloat)cq_bottom 115 | { 116 | CGRect frame = self.frame; 117 | frame.origin.y = cq_bottom - frame.size.height; 118 | self.frame = frame; 119 | } 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6F1927621FB1E6910093479B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F1927611FB1E6910093479B /* main.m */; }; 11 | 6F1927651FB1E6910093479B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F1927641FB1E6910093479B /* AppDelegate.m */; }; 12 | 6F1927681FB1E6910093479B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F1927671FB1E6910093479B /* ViewController.m */; }; 13 | 6F19276B1FB1E6910093479B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6F1927691FB1E6910093479B /* Main.storyboard */; }; 14 | 6F19276D1FB1E6910093479B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6F19276C1FB1E6910093479B /* Assets.xcassets */; }; 15 | 6F1927701FB1E6910093479B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6F19276E1FB1E6910093479B /* LaunchScreen.storyboard */; }; 16 | 6F1927791FB1E7390093479B /* SideBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F1927781FB1E7390093479B /* SideBarViewController.m */; }; 17 | 6F19278B1FB1E87C0093479B /* CQSideBarConst.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F1927861FB1E87C0093479B /* CQSideBarConst.m */; }; 18 | 6F19278C1FB1E87C0093479B /* CQSideBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F1927881FB1E87C0093479B /* CQSideBarManager.m */; }; 19 | 6F19278D1FB1E87C0093479B /* UIView+CQExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F19278A1FB1E87C0093479B /* UIView+CQExtension.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 6F19275D1FB1E6910093479B /* CQSideBarManagerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CQSideBarManagerExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 6F1927611FB1E6910093479B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 25 | 6F1927631FB1E6910093479B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 26 | 6F1927641FB1E6910093479B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | 6F1927661FB1E6910093479B /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 28 | 6F1927671FB1E6910093479B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 29 | 6F19276A1FB1E6910093479B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 30 | 6F19276C1FB1E6910093479B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 31 | 6F19276F1FB1E6910093479B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 32 | 6F1927711FB1E6910093479B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 6F1927771FB1E7390093479B /* SideBarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SideBarViewController.h; sourceTree = ""; }; 34 | 6F1927781FB1E7390093479B /* SideBarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SideBarViewController.m; sourceTree = ""; }; 35 | 6F1927851FB1E87C0093479B /* CQSideBarConst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CQSideBarConst.h; sourceTree = ""; }; 36 | 6F1927861FB1E87C0093479B /* CQSideBarConst.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CQSideBarConst.m; sourceTree = ""; }; 37 | 6F1927871FB1E87C0093479B /* CQSideBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CQSideBarManager.h; sourceTree = ""; }; 38 | 6F1927881FB1E87C0093479B /* CQSideBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CQSideBarManager.m; sourceTree = ""; }; 39 | 6F1927891FB1E87C0093479B /* UIView+CQExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+CQExtension.h"; sourceTree = ""; }; 40 | 6F19278A1FB1E87C0093479B /* UIView+CQExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+CQExtension.m"; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 6F19275A1FB1E6910093479B /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | 6F1927541FB1E6910093479B = { 55 | isa = PBXGroup; 56 | children = ( 57 | 6F19275F1FB1E6910093479B /* CQSideBarManagerExample */, 58 | 6F19275E1FB1E6910093479B /* Products */, 59 | ); 60 | sourceTree = ""; 61 | }; 62 | 6F19275E1FB1E6910093479B /* Products */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 6F19275D1FB1E6910093479B /* CQSideBarManagerExample.app */, 66 | ); 67 | name = Products; 68 | sourceTree = ""; 69 | }; 70 | 6F19275F1FB1E6910093479B /* CQSideBarManagerExample */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 6F1927841FB1E87C0093479B /* CQSideBarManager */, 74 | 6F1927631FB1E6910093479B /* AppDelegate.h */, 75 | 6F1927641FB1E6910093479B /* AppDelegate.m */, 76 | 6F1927661FB1E6910093479B /* ViewController.h */, 77 | 6F1927671FB1E6910093479B /* ViewController.m */, 78 | 6F1927771FB1E7390093479B /* SideBarViewController.h */, 79 | 6F1927781FB1E7390093479B /* SideBarViewController.m */, 80 | 6F1927691FB1E6910093479B /* Main.storyboard */, 81 | 6F19276C1FB1E6910093479B /* Assets.xcassets */, 82 | 6F19276E1FB1E6910093479B /* LaunchScreen.storyboard */, 83 | 6F1927711FB1E6910093479B /* Info.plist */, 84 | 6F1927601FB1E6910093479B /* Supporting Files */, 85 | ); 86 | path = CQSideBarManagerExample; 87 | sourceTree = ""; 88 | }; 89 | 6F1927601FB1E6910093479B /* Supporting Files */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 6F1927611FB1E6910093479B /* main.m */, 93 | ); 94 | name = "Supporting Files"; 95 | sourceTree = ""; 96 | }; 97 | 6F1927841FB1E87C0093479B /* CQSideBarManager */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 6F1927851FB1E87C0093479B /* CQSideBarConst.h */, 101 | 6F1927861FB1E87C0093479B /* CQSideBarConst.m */, 102 | 6F1927871FB1E87C0093479B /* CQSideBarManager.h */, 103 | 6F1927881FB1E87C0093479B /* CQSideBarManager.m */, 104 | 6F1927891FB1E87C0093479B /* UIView+CQExtension.h */, 105 | 6F19278A1FB1E87C0093479B /* UIView+CQExtension.m */, 106 | ); 107 | name = CQSideBarManager; 108 | path = ../../CQSideBarManager; 109 | sourceTree = ""; 110 | }; 111 | /* End PBXGroup section */ 112 | 113 | /* Begin PBXNativeTarget section */ 114 | 6F19275C1FB1E6910093479B /* CQSideBarManagerExample */ = { 115 | isa = PBXNativeTarget; 116 | buildConfigurationList = 6F1927741FB1E6910093479B /* Build configuration list for PBXNativeTarget "CQSideBarManagerExample" */; 117 | buildPhases = ( 118 | 6F1927591FB1E6910093479B /* Sources */, 119 | 6F19275A1FB1E6910093479B /* Frameworks */, 120 | 6F19275B1FB1E6910093479B /* Resources */, 121 | ); 122 | buildRules = ( 123 | ); 124 | dependencies = ( 125 | ); 126 | name = CQSideBarManagerExample; 127 | productName = CQSideBarManagerExample; 128 | productReference = 6F19275D1FB1E6910093479B /* CQSideBarManagerExample.app */; 129 | productType = "com.apple.product-type.application"; 130 | }; 131 | /* End PBXNativeTarget section */ 132 | 133 | /* Begin PBXProject section */ 134 | 6F1927551FB1E6910093479B /* Project object */ = { 135 | isa = PBXProject; 136 | attributes = { 137 | LastUpgradeCheck = 0810; 138 | ORGANIZATIONNAME = heartjoy; 139 | TargetAttributes = { 140 | 6F19275C1FB1E6910093479B = { 141 | CreatedOnToolsVersion = 8.1; 142 | DevelopmentTeam = 8UM9NNUR86; 143 | ProvisioningStyle = Automatic; 144 | }; 145 | }; 146 | }; 147 | buildConfigurationList = 6F1927581FB1E6910093479B /* Build configuration list for PBXProject "CQSideBarManagerExample" */; 148 | compatibilityVersion = "Xcode 3.2"; 149 | developmentRegion = English; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | Base, 154 | ); 155 | mainGroup = 6F1927541FB1E6910093479B; 156 | productRefGroup = 6F19275E1FB1E6910093479B /* Products */; 157 | projectDirPath = ""; 158 | projectRoot = ""; 159 | targets = ( 160 | 6F19275C1FB1E6910093479B /* CQSideBarManagerExample */, 161 | ); 162 | }; 163 | /* End PBXProject section */ 164 | 165 | /* Begin PBXResourcesBuildPhase section */ 166 | 6F19275B1FB1E6910093479B /* Resources */ = { 167 | isa = PBXResourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 6F1927701FB1E6910093479B /* LaunchScreen.storyboard in Resources */, 171 | 6F19276D1FB1E6910093479B /* Assets.xcassets in Resources */, 172 | 6F19276B1FB1E6910093479B /* Main.storyboard in Resources */, 173 | ); 174 | runOnlyForDeploymentPostprocessing = 0; 175 | }; 176 | /* End PBXResourcesBuildPhase section */ 177 | 178 | /* Begin PBXSourcesBuildPhase section */ 179 | 6F1927591FB1E6910093479B /* Sources */ = { 180 | isa = PBXSourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 6F19278C1FB1E87C0093479B /* CQSideBarManager.m in Sources */, 184 | 6F19278D1FB1E87C0093479B /* UIView+CQExtension.m in Sources */, 185 | 6F1927681FB1E6910093479B /* ViewController.m in Sources */, 186 | 6F1927651FB1E6910093479B /* AppDelegate.m in Sources */, 187 | 6F19278B1FB1E87C0093479B /* CQSideBarConst.m in Sources */, 188 | 6F1927621FB1E6910093479B /* main.m in Sources */, 189 | 6F1927791FB1E7390093479B /* SideBarViewController.m in Sources */, 190 | ); 191 | runOnlyForDeploymentPostprocessing = 0; 192 | }; 193 | /* End PBXSourcesBuildPhase section */ 194 | 195 | /* Begin PBXVariantGroup section */ 196 | 6F1927691FB1E6910093479B /* Main.storyboard */ = { 197 | isa = PBXVariantGroup; 198 | children = ( 199 | 6F19276A1FB1E6910093479B /* Base */, 200 | ); 201 | name = Main.storyboard; 202 | sourceTree = ""; 203 | }; 204 | 6F19276E1FB1E6910093479B /* LaunchScreen.storyboard */ = { 205 | isa = PBXVariantGroup; 206 | children = ( 207 | 6F19276F1FB1E6910093479B /* Base */, 208 | ); 209 | name = LaunchScreen.storyboard; 210 | sourceTree = ""; 211 | }; 212 | /* End PBXVariantGroup section */ 213 | 214 | /* Begin XCBuildConfiguration section */ 215 | 6F1927721FB1E6910093479B /* Debug */ = { 216 | isa = XCBuildConfiguration; 217 | buildSettings = { 218 | ALWAYS_SEARCH_USER_PATHS = NO; 219 | CLANG_ANALYZER_NONNULL = YES; 220 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 221 | CLANG_CXX_LIBRARY = "libc++"; 222 | CLANG_ENABLE_MODULES = YES; 223 | CLANG_ENABLE_OBJC_ARC = YES; 224 | CLANG_WARN_BOOL_CONVERSION = YES; 225 | CLANG_WARN_CONSTANT_CONVERSION = YES; 226 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 227 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 228 | CLANG_WARN_EMPTY_BODY = YES; 229 | CLANG_WARN_ENUM_CONVERSION = YES; 230 | CLANG_WARN_INFINITE_RECURSION = YES; 231 | CLANG_WARN_INT_CONVERSION = YES; 232 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 233 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 234 | CLANG_WARN_UNREACHABLE_CODE = YES; 235 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 236 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 237 | COPY_PHASE_STRIP = NO; 238 | DEBUG_INFORMATION_FORMAT = dwarf; 239 | ENABLE_STRICT_OBJC_MSGSEND = YES; 240 | ENABLE_TESTABILITY = YES; 241 | GCC_C_LANGUAGE_STANDARD = gnu99; 242 | GCC_DYNAMIC_NO_PIC = NO; 243 | GCC_NO_COMMON_BLOCKS = YES; 244 | GCC_OPTIMIZATION_LEVEL = 0; 245 | GCC_PREPROCESSOR_DEFINITIONS = ( 246 | "DEBUG=1", 247 | "$(inherited)", 248 | ); 249 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 250 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 251 | GCC_WARN_UNDECLARED_SELECTOR = YES; 252 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 253 | GCC_WARN_UNUSED_FUNCTION = YES; 254 | GCC_WARN_UNUSED_VARIABLE = YES; 255 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 256 | MTL_ENABLE_DEBUG_INFO = YES; 257 | ONLY_ACTIVE_ARCH = YES; 258 | SDKROOT = iphoneos; 259 | }; 260 | name = Debug; 261 | }; 262 | 6F1927731FB1E6910093479B /* Release */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | ALWAYS_SEARCH_USER_PATHS = NO; 266 | CLANG_ANALYZER_NONNULL = YES; 267 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 268 | CLANG_CXX_LIBRARY = "libc++"; 269 | CLANG_ENABLE_MODULES = YES; 270 | CLANG_ENABLE_OBJC_ARC = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_CONSTANT_CONVERSION = YES; 273 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 274 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 275 | CLANG_WARN_EMPTY_BODY = YES; 276 | CLANG_WARN_ENUM_CONVERSION = YES; 277 | CLANG_WARN_INFINITE_RECURSION = YES; 278 | CLANG_WARN_INT_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 286 | ENABLE_NS_ASSERTIONS = NO; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | GCC_C_LANGUAGE_STANDARD = gnu99; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 10.1; 297 | MTL_ENABLE_DEBUG_INFO = NO; 298 | SDKROOT = iphoneos; 299 | VALIDATE_PRODUCT = YES; 300 | }; 301 | name = Release; 302 | }; 303 | 6F1927751FB1E6910093479B /* Debug */ = { 304 | isa = XCBuildConfiguration; 305 | buildSettings = { 306 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 307 | DEVELOPMENT_TEAM = 8UM9NNUR86; 308 | INFOPLIST_FILE = CQSideBarManagerExample/Info.plist; 309 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 310 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 311 | PRODUCT_BUNDLE_IDENTIFIER = com.ccq.CQSideBarManagerExample; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | }; 314 | name = Debug; 315 | }; 316 | 6F1927761FB1E6910093479B /* Release */ = { 317 | isa = XCBuildConfiguration; 318 | buildSettings = { 319 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 320 | DEVELOPMENT_TEAM = 8UM9NNUR86; 321 | INFOPLIST_FILE = CQSideBarManagerExample/Info.plist; 322 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 323 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 324 | PRODUCT_BUNDLE_IDENTIFIER = com.ccq.CQSideBarManagerExample; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | }; 327 | name = Release; 328 | }; 329 | /* End XCBuildConfiguration section */ 330 | 331 | /* Begin XCConfigurationList section */ 332 | 6F1927581FB1E6910093479B /* Build configuration list for PBXProject "CQSideBarManagerExample" */ = { 333 | isa = XCConfigurationList; 334 | buildConfigurations = ( 335 | 6F1927721FB1E6910093479B /* Debug */, 336 | 6F1927731FB1E6910093479B /* Release */, 337 | ); 338 | defaultConfigurationIsVisible = 0; 339 | defaultConfigurationName = Release; 340 | }; 341 | 6F1927741FB1E6910093479B /* Build configuration list for PBXNativeTarget "CQSideBarManagerExample" */ = { 342 | isa = XCConfigurationList; 343 | buildConfigurations = ( 344 | 6F1927751FB1E6910093479B /* Debug */, 345 | 6F1927761FB1E6910093479B /* Release */, 346 | ); 347 | defaultConfigurationIsVisible = 0; 348 | defaultConfigurationName = Release; 349 | }; 350 | /* End XCConfigurationList section */ 351 | }; 352 | rootObject = 6F1927551FB1E6910093479B /* Project object */; 353 | } 354 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CQSideBarManagerExample 4 | // 5 | // Created by heartjoy on 2017/11/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CQSideBarManagerExample 4 | // 5 | // Created by heartjoy on 2017/11/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/SideBarViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SideBarViewController.h 3 | // CQSideBarManager 4 | // 5 | // Created by heartjoy on 2017/11/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SideBarViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/SideBarViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SideBarViewController.m 3 | // CQSideBarManager 4 | // 5 | // Created by heartjoy on 2017/11/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import "SideBarViewController.h" 10 | #import "CQSideBarConst.h" 11 | #import "CQSideBarManager.h" 12 | 13 | @interface SideBarViewController () 14 | 15 | 16 | @end 17 | 18 | @implementation SideBarViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view. 23 | 24 | self.view.backgroundColor = SIDEBAR_RANDOM_COLOR; 25 | 26 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; 27 | btn.frame = CGRectMake(100, 100, 100, 50); 28 | [btn setTitle:@"点击" forState:UIControlStateNormal]; 29 | [btn addTarget:self action:@selector(closeView) forControlEvents:UIControlEventTouchUpInside]; 30 | [self.view addSubview:btn]; 31 | } 32 | 33 | - (void)closeView 34 | { 35 | [[CQSideBarManager sharedInstance] closeSideBar]; 36 | } 37 | 38 | - (void)didReceiveMemoryWarning { 39 | [super didReceiveMemoryWarning]; 40 | // Dispose of any resources that can be recreated. 41 | } 42 | 43 | - (void)dealloc 44 | { 45 | NSLog(@"SideBarViewController dealloc"); 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CQSideBarManagerExample 4 | // 5 | // Created by heartjoy on 2017/11/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CQSideBarManagerExample 4 | // 5 | // Created by heartjoy on 2017/11/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SideBarViewController.h" 11 | 12 | #import "CQSideBarManager.h" 13 | 14 | @interface ViewController () 15 | 16 | @property (nonatomic, strong) SideBarViewController *sideBarVC; 17 | 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | #pragma mark - View lifecycle 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | // Do any additional setup after loading the view, typically from a nib. 27 | } 28 | 29 | - (void)didReceiveMemoryWarning { 30 | [super didReceiveMemoryWarning]; 31 | // Dispose of any resources that can be recreated. 32 | } 33 | 34 | #pragma mark - actions 35 | - (IBAction)showAction:(id)sender { 36 | [[CQSideBarManager sharedInstance] openSideBar:self]; 37 | } 38 | 39 | #pragma mark - CQSideBarManagerDelegate 40 | - (UIView *)viewForSideBar 41 | { 42 | /* 43 | * 如果使用VC的view作为侧边栏视图,那么需要注意在ARC模式下控制器出了作用域会被释放掉这种情况,导致无法响应点击事件,个别同学已经碰到这种问题,现已作出解释。比如以下这个写法: 44 | * SideBarViewController *sideBarVC = [[SideBarViewController alloc] init]; 45 | * sideBarVC.view.cq_width = self.view.cq_width - 35.f; 46 | * return sideBarVC.view; 47 | */ 48 | return self.sideBarVC.view; 49 | } 50 | 51 | - (BOOL)canCloseSideBar 52 | { 53 | return YES; 54 | } 55 | 56 | #pragma mark ---Getter 57 | - (SideBarViewController *)sideBarVC 58 | { 59 | if (!_sideBarVC) { 60 | _sideBarVC = [[SideBarViewController alloc] init]; 61 | _sideBarVC.view.cq_width = self.view.cq_width - 35.f; 62 | } 63 | return _sideBarVC; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /CQSideBarManagerExample/CQSideBarManagerExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CQSideBarManagerExample 4 | // 5 | // Created by heartjoy on 2017/11/7. 6 | // Copyright © 2017年 heartjoy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 heartjoy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## CQSideBarManager 3 | * a useful sideBar Manager for iOS. 4 | 5 | ## ScreenShot 6 | ![](https://github.com/heartjoy/CQSideBarManager/blob/master/%E6%BC%94%E7%A4%BA%E9%A1%B9%E7%9B%AE.gif) 7 | 8 | ## Requirements 9 | 10 | * iOS 7.0 or higher 11 | * ARC 12 | 13 | ## Features 14 | 15 | * can open the sideBar 16 | * can close the sideBar 17 | * support customize the sideBar 18 | * support device rotation 19 | * support to click mask to close the sideBar 20 | * support CocoaPods 21 | 22 | ## Delegate 23 | ``` 24 | @required 25 | - (UIView *)viewForSideBar; 26 | 27 | @optional 28 | /** 29 | * 点击遮罩层关闭侧边栏,默认为YES 30 | */ 31 | - (BOOL)canCloseSideBar; 32 | 33 | ``` 34 | ## CocoaPods 35 | * pod "CQSideBarManager" 36 | 37 | ## Examples 38 | 39 | ``` 40 | //打开侧边栏 41 | [[CQSideBarManager sharedInstance] openSideBar:self]; 42 | 43 | //关闭侧边栏 44 | [[CQSideBarManager sharedInstance] closeSideBar]; 45 | ``` 46 | ## Hope 47 | 48 | * If you have any questions during the process or want more interfaces to customize,you can issues me ! 49 | * If you find the function is not enough when used,Hope you can issues me,I very much to add more useful function to this framework ,Thank you ! 50 | 51 | ## Licenses 52 | All source code is licensed under the MIT License. 53 | -------------------------------------------------------------------------------- /演示项目.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heartjoy/CQSideBarManager/3bd628ef7ffad2c279aff9cfb4bb163267e0b396/演示项目.gif --------------------------------------------------------------------------------