├── .gitignore ├── .travis.yml ├── LCNCDemo.gif ├── LCNCDemo.png ├── LCNavigationController.podspec ├── LCNavigationController ├── LCNavigationController.h └── LCNavigationController.m ├── LCNavigationControllerDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ ├── Leo.xcuserdatad │ └── xcschemes │ │ ├── LCNavigationControllerDemo.xcscheme │ │ └── xcschememanagement.plist │ └── newuser.xcuserdatad │ └── xcschemes │ ├── LCNavigationControllerDemo.xcscheme │ └── xcschememanagement.plist ├── LCNavigationControllerDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── OneVC.h ├── OneVC.m ├── ThreeVC.h ├── ThreeVC.m ├── TwoVC.h ├── TwoVC.m └── main.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | LCNavigationControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/Leo.xcuserdatad/UserInterfaceState.xcuserstate 3 | 4 | LCNavigationControllerDemo.xcodeproj/project.xcworkspace/xcuserdata/newuser.xcuserdatad/UserInterfaceState.xcuserstate 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | os: osx 3 | osx_image: xcode7.2 -------------------------------------------------------------------------------- /LCNCDemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iTofu/LCNavigationController/3c9bf503cbf3952ebe69fc8d7c246c157e05adb3/LCNCDemo.gif -------------------------------------------------------------------------------- /LCNCDemo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iTofu/LCNavigationController/3c9bf503cbf3952ebe69fc8d7c246c157e05adb3/LCNCDemo.png -------------------------------------------------------------------------------- /LCNavigationController.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "LCNavigationController" 4 | s.version = "1.0.6" 5 | s.summary = "The most popular navigationController except UINavigationController. Support: http://LeoDev.me" 6 | s.homepage = "https://github.com/iTofu/LCNavigationController" 7 | s.license = { :type => "MIT", :file => "LICENSE" } 8 | s.author = { "Leo" => "devtip@163.com" } 9 | s.social_media_url = "http://LeoDev.me" 10 | s.platform = :ios, "7.0" 11 | s.source = { :git => "https://github.com/iTofu/LCNavigationController.git", :tag => s.version } 12 | s.source_files = "LCNavigationController/*" 13 | s.requires_arc = true 14 | 15 | end 16 | -------------------------------------------------------------------------------- /LCNavigationController/LCNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LCNavigationController.h 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. All rights reserved. 7 | // 8 | // V 1.0.6 9 | 10 | #import 11 | 12 | 13 | typedef void (^LCNavigationControllerCompletionBlock)(void); 14 | 15 | 16 | @interface LCNavigationController : UIViewController 17 | 18 | @property(nonatomic, strong) NSMutableArray *viewControllers; 19 | 20 | 21 | - (instancetype)initWithRootViewController:(UIViewController *)rootViewController; 22 | 23 | 24 | - (void)pushViewController:(UIViewController *)viewController; 25 | 26 | - (void)pushViewController:(UIViewController *)viewController 27 | completion:(LCNavigationControllerCompletionBlock)completion; 28 | 29 | 30 | - (void)popViewController; 31 | 32 | - (void)popViewControllerCompletion:(LCNavigationControllerCompletionBlock)completion; 33 | 34 | 35 | - (void)popToRootViewController; 36 | 37 | - (void)popToViewController:(UIViewController*)toViewController; 38 | 39 | 40 | 41 | @end 42 | 43 | 44 | 45 | 46 | @interface UIViewController (LCNavigationController) 47 | 48 | @property (nonatomic, strong) LCNavigationController *lcNavigationController; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /LCNavigationController/LCNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LCNavigationController.m 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. All rights reserved. 7 | // 8 | 9 | #import "LCNavigationController.h" 10 | 11 | static const CGFloat LCAnimationDuration = 0.50f; // Push / Pop 动画持续时间 12 | static const CGFloat LCMaxBlackMaskAlpha = 0.80f; // 黑色背景透明度 13 | static const CGFloat LCZoomRatio = 0.90f; // 后面视图缩放比 14 | static const CGFloat LCShadowOpacity = 0.80f; // 滑动返回时当前视图的阴影透明度 15 | static const CGFloat LCShadowRadius = 8.00f; // 滑动返回时当前视图的阴影半径 16 | 17 | typedef enum : NSUInteger { 18 | PanDirectionNone, 19 | PanDirectionLeft, 20 | PanDirectionRight, 21 | } PanDirection; 22 | 23 | @interface LCNavigationController () 24 | 25 | @property (nonatomic, strong) NSMutableArray *gestures; 26 | @property (nonatomic, weak) UIView *blackMask; 27 | @property (nonatomic, assign) BOOL animationing; 28 | @property (nonatomic, assign) CGPoint panOrigin; 29 | @property (nonatomic, assign) CGFloat percentageOffsetFromLeft; 30 | 31 | @end 32 | 33 | @implementation LCNavigationController 34 | 35 | - (void)dealloc { 36 | 37 | self.viewControllers = nil; 38 | self.gestures = nil; 39 | self.blackMask = nil; 40 | } 41 | 42 | - (instancetype)initWithRootViewController:(UIViewController *)rootViewController { 43 | 44 | if (self = [super init]) { 45 | 46 | self.viewControllers = [NSMutableArray arrayWithObject:rootViewController]; 47 | } 48 | return self; 49 | } 50 | 51 | - (CGRect)viewBoundsWithOrientation:(UIInterfaceOrientation)orientation { 52 | 53 | CGRect bounds = [UIScreen mainScreen].bounds; 54 | 55 | if ([[UIApplication sharedApplication]isStatusBarHidden]) { 56 | 57 | return bounds; 58 | 59 | } else if (UIInterfaceOrientationIsLandscape(orientation)) { 60 | 61 | CGFloat width = bounds.size.width; 62 | bounds.size.width = bounds.size.height; 63 | bounds.size.height = width; 64 | 65 | return bounds; 66 | 67 | } else { 68 | 69 | return bounds; 70 | } 71 | } 72 | 73 | - (void)loadView { 74 | 75 | [super loadView]; 76 | 77 | CGRect viewRect = [self viewBoundsWithOrientation:self.interfaceOrientation]; 78 | 79 | UIViewController *rootViewController = [self.viewControllers firstObject]; 80 | [rootViewController willMoveToParentViewController:self]; 81 | [self addChildViewController:rootViewController]; 82 | 83 | UIView *rootView = rootViewController.view; 84 | rootView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 85 | rootView.frame = viewRect; 86 | [self.view addSubview:rootView]; 87 | [rootViewController didMoveToParentViewController:self]; 88 | 89 | UIView *blackMask = [[UIView alloc] initWithFrame:viewRect]; 90 | blackMask.backgroundColor = [UIColor blackColor]; 91 | blackMask.alpha = 0; 92 | blackMask.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 93 | [self.view insertSubview:blackMask atIndex:0]; 94 | self.blackMask = blackMask; 95 | 96 | self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 97 | } 98 | 99 | - (UIViewController *)currentViewController { 100 | 101 | UIViewController *result = nil; 102 | if (self.viewControllers.count) result = [self.viewControllers lastObject]; 103 | return result; 104 | } 105 | 106 | - (UIViewController *)previousViewController { 107 | 108 | UIViewController *result = nil; 109 | if (self.viewControllers.count > 1) { 110 | result = [self.viewControllers objectAtIndex:self.viewControllers.count - 2]; 111 | } 112 | return result; 113 | } 114 | 115 | - (void)addPanGestureToView:(UIView*)view { 116 | 117 | UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self 118 | action:@selector(gestureRecognizerDidPan:)]; 119 | panGesture.delegate = self; 120 | [view addGestureRecognizer:panGesture]; 121 | [self.gestures addObject:panGesture]; 122 | } 123 | 124 | - (void)gestureRecognizerDidPan:(UIPanGestureRecognizer*)panGesture { 125 | 126 | if (self.animationing) return; 127 | 128 | CGPoint currentPoint = [panGesture translationInView:self.view]; 129 | CGFloat x = currentPoint.x + self.panOrigin.x; 130 | 131 | PanDirection panDirection = PanDirectionNone; 132 | CGPoint vel = [panGesture velocityInView:self.view]; 133 | 134 | if (vel.x > 0) { 135 | panDirection = PanDirectionRight; 136 | } else { 137 | panDirection = PanDirectionLeft; 138 | } 139 | 140 | CGFloat offset = 0; 141 | 142 | UIViewController *vc = [self currentViewController]; 143 | offset = CGRectGetWidth(vc.view.frame) - x; 144 | vc.view.layer.shadowColor = [UIColor blackColor].CGColor; 145 | vc.view.layer.shadowOpacity = LCShadowOpacity; 146 | vc.view.layer.shadowRadius = LCShadowRadius; 147 | 148 | self.percentageOffsetFromLeft = offset / [self viewBoundsWithOrientation:self.interfaceOrientation].size.width; 149 | vc.view.frame = [self getSlidingRectWithPercentageOffset:self.percentageOffsetFromLeft orientation:self.interfaceOrientation]; 150 | [self transformAtPercentage:self.percentageOffsetFromLeft]; 151 | 152 | if (panGesture.state == UIGestureRecognizerStateEnded || panGesture.state == UIGestureRecognizerStateCancelled) { 153 | 154 | if (fabs(vel.x) > 100) { 155 | 156 | [self completeSlidingAnimationWithDirection:panDirection]; 157 | 158 | } else { 159 | 160 | [self completeSlidingAnimationWithOffset:offset]; 161 | } 162 | } 163 | } 164 | 165 | - (void)completeSlidingAnimationWithDirection:(PanDirection)direction { 166 | 167 | if (direction == PanDirectionRight){ 168 | 169 | [self popViewController]; 170 | 171 | } else { 172 | 173 | [self rollBackViewController]; 174 | } 175 | } 176 | 177 | - (void)completeSlidingAnimationWithOffset:(CGFloat)offset{ 178 | 179 | if (offset < [self viewBoundsWithOrientation:self.interfaceOrientation].size.width * 0.5f) { 180 | 181 | [self popViewController]; 182 | 183 | } else { 184 | 185 | [self rollBackViewController]; 186 | } 187 | } 188 | 189 | - (void)rollBackViewController { 190 | 191 | self.animationing = YES; 192 | 193 | UIViewController *vc = [self currentViewController]; 194 | UIViewController *nvc = [self previousViewController]; 195 | CGRect rect = CGRectMake(0, 0, vc.view.frame.size.width, vc.view.frame.size.height); 196 | 197 | [UIView animateWithDuration:0.3f delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 198 | 199 | CGAffineTransform transf = CGAffineTransformIdentity; 200 | nvc.view.transform = CGAffineTransformScale(transf, LCZoomRatio, LCZoomRatio); 201 | vc.view.frame = rect; 202 | self.blackMask.alpha = LCMaxBlackMaskAlpha; 203 | 204 | } completion:^(BOOL finished) { 205 | 206 | if (finished) { 207 | 208 | self.animationing = NO; 209 | } 210 | }]; 211 | } 212 | 213 | - (CGRect)getSlidingRectWithPercentageOffset:(CGFloat)percentage orientation:(UIInterfaceOrientation)orientation { 214 | 215 | CGRect viewRect = [self viewBoundsWithOrientation:orientation]; 216 | CGRect rectToReturn = CGRectZero; 217 | rectToReturn.size = viewRect.size; 218 | rectToReturn.origin = CGPointMake(MAX(0, (1 - percentage) * viewRect.size.width), 0); 219 | 220 | return rectToReturn; 221 | } 222 | 223 | - (void)transformAtPercentage:(CGFloat)percentage { 224 | 225 | CGAffineTransform transf = CGAffineTransformIdentity; 226 | CGFloat newTransformValue = 1 - percentage * (1 - LCZoomRatio); 227 | CGFloat newAlphaValue = percentage * LCMaxBlackMaskAlpha; 228 | [self previousViewController].view.transform = CGAffineTransformScale(transf, newTransformValue, newTransformValue); 229 | 230 | self.blackMask.alpha = newAlphaValue; 231 | } 232 | 233 | - (void)pushViewController:(UIViewController *)viewController completion:(LCNavigationControllerCompletionBlock)completion { 234 | 235 | self.animationing = YES; 236 | 237 | 238 | viewController.view.layer.shadowColor = [UIColor blackColor].CGColor; 239 | viewController.view.layer.shadowOpacity = LCShadowOpacity; 240 | viewController.view.layer.shadowRadius = LCShadowRadius; 241 | 242 | viewController.view.frame = CGRectOffset(self.view.bounds, self.view.bounds.size.width, 0); 243 | viewController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 244 | self.blackMask.alpha = 0; 245 | [viewController willMoveToParentViewController:self]; 246 | [self addChildViewController:viewController]; 247 | 248 | [self.view bringSubviewToFront:self.blackMask]; 249 | [self.view addSubview:viewController.view]; 250 | 251 | [UIView animateWithDuration:LCAnimationDuration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 252 | 253 | CGAffineTransform transf = CGAffineTransformIdentity; 254 | [self currentViewController].view.transform = CGAffineTransformScale(transf, LCZoomRatio, LCZoomRatio); 255 | viewController.view.frame = self.view.bounds; 256 | self.blackMask.alpha = LCMaxBlackMaskAlpha; 257 | 258 | } completion:^(BOOL finished) { 259 | 260 | if (finished) { 261 | 262 | [self.viewControllers addObject:viewController]; 263 | [viewController didMoveToParentViewController:self]; 264 | 265 | self.animationing = NO; 266 | self.gestures = [[NSMutableArray alloc] init]; 267 | [self addPanGestureToView:[self currentViewController].view]; 268 | 269 | if (completion != nil) completion(); 270 | } 271 | }]; 272 | } 273 | 274 | - (void)pushViewController:(UIViewController *)viewController { 275 | 276 | [self pushViewController:viewController completion:nil]; 277 | } 278 | 279 | - (void)popViewControllerCompletion:(LCNavigationControllerCompletionBlock)completion { 280 | 281 | if (self.viewControllers.count < 2) return; 282 | 283 | self.animationing = YES; 284 | 285 | UIViewController *currentVC = [self currentViewController]; 286 | UIViewController *previousVC = [self previousViewController]; 287 | [previousVC viewWillAppear:NO]; 288 | 289 | currentVC.view.layer.shadowColor = [UIColor blackColor].CGColor; 290 | currentVC.view.layer.shadowOpacity = LCShadowOpacity; 291 | currentVC.view.layer.shadowRadius = LCShadowRadius; 292 | 293 | [UIView animateWithDuration:LCAnimationDuration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 294 | 295 | currentVC.view.frame = CGRectOffset(self.view.bounds, self.view.bounds.size.width, 0); 296 | CGAffineTransform transf = CGAffineTransformIdentity; 297 | previousVC.view.transform = CGAffineTransformScale(transf, 1.0f, 1.0f); 298 | previousVC.view.frame = self.view.bounds; 299 | self.blackMask.alpha = 0; 300 | 301 | } completion:^(BOOL finished) { 302 | 303 | if (finished) { 304 | 305 | [currentVC.view removeFromSuperview]; 306 | [currentVC willMoveToParentViewController:nil]; 307 | 308 | [self.view bringSubviewToFront:[self previousViewController].view]; 309 | [currentVC removeFromParentViewController]; 310 | [currentVC didMoveToParentViewController:nil]; 311 | 312 | [self.viewControllers removeObject:currentVC]; 313 | self.animationing = NO; 314 | [previousVC viewDidAppear:NO]; 315 | 316 | if (completion != nil) completion(); 317 | } 318 | }]; 319 | 320 | } 321 | 322 | - (void) popViewController { 323 | 324 | [self popViewControllerCompletion:nil]; 325 | } 326 | 327 | - (void)popToViewController:(UIViewController*)toViewController { 328 | 329 | NSMutableArray *controllers = self.viewControllers; 330 | NSInteger index = [controllers indexOfObject:toViewController]; 331 | UIViewController *needRemoveViewController = nil; 332 | 333 | for (int i = (int)controllers.count - 2; i > index; i--) { 334 | 335 | needRemoveViewController = [controllers objectAtIndex:i]; 336 | [needRemoveViewController.view setAlpha:0]; 337 | 338 | [needRemoveViewController removeFromParentViewController]; 339 | [controllers removeObject:needRemoveViewController]; 340 | } 341 | 342 | [self popViewController]; 343 | } 344 | 345 | - (void)popToRootViewController { 346 | 347 | UIViewController *rootController = [self.viewControllers objectAtIndex:0]; 348 | [self popToViewController:rootController]; 349 | } 350 | 351 | 352 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 353 | 354 | return (toInterfaceOrientation == UIInterfaceOrientationPortrait); 355 | } 356 | 357 | - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 358 | 359 | } 360 | 361 | @end 362 | 363 | 364 | 365 | 366 | @implementation UIViewController (LCNavigationController) 367 | 368 | @dynamic lcNavigationController; 369 | 370 | - (LCNavigationController *)lcNavigationController { 371 | 372 | UIResponder *responder = [self nextResponder]; 373 | 374 | while (responder) { 375 | 376 | if ([responder isKindOfClass:[LCNavigationController class]]) { 377 | 378 | return (LCNavigationController *)responder; 379 | } 380 | 381 | responder = [responder nextResponder]; 382 | } 383 | 384 | return nil; 385 | } 386 | 387 | 388 | @end 389 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B34AADC41BFF062E00E9BC3A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B34AADC31BFF062E00E9BC3A /* main.m */; }; 11 | B34AADC71BFF062E00E9BC3A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B34AADC61BFF062E00E9BC3A /* AppDelegate.m */; }; 12 | B34AADCD1BFF062E00E9BC3A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B34AADCB1BFF062E00E9BC3A /* Main.storyboard */; }; 13 | B34AADCF1BFF062E00E9BC3A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B34AADCE1BFF062E00E9BC3A /* Assets.xcassets */; }; 14 | B34AADD21BFF062E00E9BC3A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B34AADD01BFF062E00E9BC3A /* LaunchScreen.storyboard */; }; 15 | B34AADDC1BFF064800E9BC3A /* LCNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = B34AADDB1BFF064800E9BC3A /* LCNavigationController.m */; }; 16 | B34AADDF1BFF161100E9BC3A /* OneVC.m in Sources */ = {isa = PBXBuildFile; fileRef = B34AADDE1BFF161100E9BC3A /* OneVC.m */; }; 17 | B34AADE21BFF161800E9BC3A /* TwoVC.m in Sources */ = {isa = PBXBuildFile; fileRef = B34AADE11BFF161800E9BC3A /* TwoVC.m */; }; 18 | B34AADE81BFF25FC00E9BC3A /* ThreeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = B34AADE71BFF25FC00E9BC3A /* ThreeVC.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | B34AADBF1BFF062E00E9BC3A /* LCNavigationControllerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LCNavigationControllerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | B34AADC31BFF062E00E9BC3A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 24 | B34AADC51BFF062E00E9BC3A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 25 | B34AADC61BFF062E00E9BC3A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 26 | B34AADCC1BFF062E00E9BC3A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | B34AADCE1BFF062E00E9BC3A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | B34AADD11BFF062E00E9BC3A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | B34AADD31BFF062E00E9BC3A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | B34AADDA1BFF064800E9BC3A /* LCNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LCNavigationController.h; sourceTree = ""; }; 31 | B34AADDB1BFF064800E9BC3A /* LCNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCNavigationController.m; sourceTree = ""; }; 32 | B34AADDD1BFF161100E9BC3A /* OneVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OneVC.h; sourceTree = ""; }; 33 | B34AADDE1BFF161100E9BC3A /* OneVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OneVC.m; sourceTree = ""; }; 34 | B34AADE01BFF161800E9BC3A /* TwoVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TwoVC.h; sourceTree = ""; }; 35 | B34AADE11BFF161800E9BC3A /* TwoVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TwoVC.m; sourceTree = ""; }; 36 | B34AADE61BFF25FB00E9BC3A /* ThreeVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreeVC.h; sourceTree = ""; }; 37 | B34AADE71BFF25FC00E9BC3A /* ThreeVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThreeVC.m; sourceTree = ""; }; 38 | /* End PBXFileReference section */ 39 | 40 | /* Begin PBXFrameworksBuildPhase section */ 41 | B34AADBC1BFF062E00E9BC3A /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXFrameworksBuildPhase section */ 49 | 50 | /* Begin PBXGroup section */ 51 | B34AADB61BFF062E00E9BC3A = { 52 | isa = PBXGroup; 53 | children = ( 54 | B34AADD91BFF063200E9BC3A /* LCNavigationController */, 55 | B34AADC11BFF062E00E9BC3A /* LCNavigationControllerDemo */, 56 | B34AADC01BFF062E00E9BC3A /* Products */, 57 | ); 58 | sourceTree = ""; 59 | }; 60 | B34AADC01BFF062E00E9BC3A /* Products */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | B34AADBF1BFF062E00E9BC3A /* LCNavigationControllerDemo.app */, 64 | ); 65 | name = Products; 66 | sourceTree = ""; 67 | }; 68 | B34AADC11BFF062E00E9BC3A /* LCNavigationControllerDemo */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | B34AADC51BFF062E00E9BC3A /* AppDelegate.h */, 72 | B34AADC61BFF062E00E9BC3A /* AppDelegate.m */, 73 | B34AADCB1BFF062E00E9BC3A /* Main.storyboard */, 74 | B34AADDD1BFF161100E9BC3A /* OneVC.h */, 75 | B34AADDE1BFF161100E9BC3A /* OneVC.m */, 76 | B34AADE01BFF161800E9BC3A /* TwoVC.h */, 77 | B34AADE11BFF161800E9BC3A /* TwoVC.m */, 78 | B34AADE61BFF25FB00E9BC3A /* ThreeVC.h */, 79 | B34AADE71BFF25FC00E9BC3A /* ThreeVC.m */, 80 | B34AADCE1BFF062E00E9BC3A /* Assets.xcassets */, 81 | B34AADD01BFF062E00E9BC3A /* LaunchScreen.storyboard */, 82 | B34AADD31BFF062E00E9BC3A /* Info.plist */, 83 | B34AADC21BFF062E00E9BC3A /* Supporting Files */, 84 | ); 85 | path = LCNavigationControllerDemo; 86 | sourceTree = ""; 87 | }; 88 | B34AADC21BFF062E00E9BC3A /* Supporting Files */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | B34AADC31BFF062E00E9BC3A /* main.m */, 92 | ); 93 | name = "Supporting Files"; 94 | sourceTree = ""; 95 | }; 96 | B34AADD91BFF063200E9BC3A /* LCNavigationController */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | B34AADDA1BFF064800E9BC3A /* LCNavigationController.h */, 100 | B34AADDB1BFF064800E9BC3A /* LCNavigationController.m */, 101 | ); 102 | path = LCNavigationController; 103 | sourceTree = ""; 104 | }; 105 | /* End PBXGroup section */ 106 | 107 | /* Begin PBXNativeTarget section */ 108 | B34AADBE1BFF062E00E9BC3A /* LCNavigationControllerDemo */ = { 109 | isa = PBXNativeTarget; 110 | buildConfigurationList = B34AADD61BFF062E00E9BC3A /* Build configuration list for PBXNativeTarget "LCNavigationControllerDemo" */; 111 | buildPhases = ( 112 | B34AADBB1BFF062E00E9BC3A /* Sources */, 113 | B34AADBC1BFF062E00E9BC3A /* Frameworks */, 114 | B34AADBD1BFF062E00E9BC3A /* Resources */, 115 | ); 116 | buildRules = ( 117 | ); 118 | dependencies = ( 119 | ); 120 | name = LCNavigationControllerDemo; 121 | productName = LCNavigationControllerDemo; 122 | productReference = B34AADBF1BFF062E00E9BC3A /* LCNavigationControllerDemo.app */; 123 | productType = "com.apple.product-type.application"; 124 | }; 125 | /* End PBXNativeTarget section */ 126 | 127 | /* Begin PBXProject section */ 128 | B34AADB71BFF062E00E9BC3A /* Project object */ = { 129 | isa = PBXProject; 130 | attributes = { 131 | LastUpgradeCheck = 0710; 132 | ORGANIZATIONNAME = Leo; 133 | TargetAttributes = { 134 | B34AADBE1BFF062E00E9BC3A = { 135 | CreatedOnToolsVersion = 7.1.1; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = B34AADBA1BFF062E00E9BC3A /* Build configuration list for PBXProject "LCNavigationControllerDemo" */; 140 | compatibilityVersion = "Xcode 3.2"; 141 | developmentRegion = English; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = B34AADB61BFF062E00E9BC3A; 148 | productRefGroup = B34AADC01BFF062E00E9BC3A /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | B34AADBE1BFF062E00E9BC3A /* LCNavigationControllerDemo */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | B34AADBD1BFF062E00E9BC3A /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | B34AADD21BFF062E00E9BC3A /* LaunchScreen.storyboard in Resources */, 163 | B34AADCF1BFF062E00E9BC3A /* Assets.xcassets in Resources */, 164 | B34AADCD1BFF062E00E9BC3A /* Main.storyboard in Resources */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXResourcesBuildPhase section */ 169 | 170 | /* Begin PBXSourcesBuildPhase section */ 171 | B34AADBB1BFF062E00E9BC3A /* Sources */ = { 172 | isa = PBXSourcesBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | B34AADDF1BFF161100E9BC3A /* OneVC.m in Sources */, 176 | B34AADC71BFF062E00E9BC3A /* AppDelegate.m in Sources */, 177 | B34AADE21BFF161800E9BC3A /* TwoVC.m in Sources */, 178 | B34AADE81BFF25FC00E9BC3A /* ThreeVC.m in Sources */, 179 | B34AADDC1BFF064800E9BC3A /* LCNavigationController.m in Sources */, 180 | B34AADC41BFF062E00E9BC3A /* main.m in Sources */, 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | }; 184 | /* End PBXSourcesBuildPhase section */ 185 | 186 | /* Begin PBXVariantGroup section */ 187 | B34AADCB1BFF062E00E9BC3A /* Main.storyboard */ = { 188 | isa = PBXVariantGroup; 189 | children = ( 190 | B34AADCC1BFF062E00E9BC3A /* Base */, 191 | ); 192 | name = Main.storyboard; 193 | sourceTree = ""; 194 | }; 195 | B34AADD01BFF062E00E9BC3A /* LaunchScreen.storyboard */ = { 196 | isa = PBXVariantGroup; 197 | children = ( 198 | B34AADD11BFF062E00E9BC3A /* Base */, 199 | ); 200 | name = LaunchScreen.storyboard; 201 | sourceTree = ""; 202 | }; 203 | /* End PBXVariantGroup section */ 204 | 205 | /* Begin XCBuildConfiguration section */ 206 | B34AADD41BFF062E00E9BC3A /* Debug */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ALWAYS_SEARCH_USER_PATHS = NO; 210 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 211 | CLANG_CXX_LIBRARY = "libc++"; 212 | CLANG_ENABLE_MODULES = YES; 213 | CLANG_ENABLE_OBJC_ARC = YES; 214 | CLANG_WARN_BOOL_CONVERSION = YES; 215 | CLANG_WARN_CONSTANT_CONVERSION = YES; 216 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 217 | CLANG_WARN_EMPTY_BODY = YES; 218 | CLANG_WARN_ENUM_CONVERSION = YES; 219 | CLANG_WARN_INT_CONVERSION = YES; 220 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 221 | CLANG_WARN_UNREACHABLE_CODE = YES; 222 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 223 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 224 | COPY_PHASE_STRIP = NO; 225 | DEBUG_INFORMATION_FORMAT = dwarf; 226 | ENABLE_STRICT_OBJC_MSGSEND = YES; 227 | ENABLE_TESTABILITY = YES; 228 | GCC_C_LANGUAGE_STANDARD = gnu99; 229 | GCC_DYNAMIC_NO_PIC = NO; 230 | GCC_NO_COMMON_BLOCKS = YES; 231 | GCC_OPTIMIZATION_LEVEL = 0; 232 | GCC_PREPROCESSOR_DEFINITIONS = ( 233 | "DEBUG=1", 234 | "$(inherited)", 235 | ); 236 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 237 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 238 | GCC_WARN_UNDECLARED_SELECTOR = YES; 239 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 240 | GCC_WARN_UNUSED_FUNCTION = YES; 241 | GCC_WARN_UNUSED_VARIABLE = YES; 242 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 243 | MTL_ENABLE_DEBUG_INFO = YES; 244 | ONLY_ACTIVE_ARCH = YES; 245 | SDKROOT = iphoneos; 246 | TARGETED_DEVICE_FAMILY = "1,2"; 247 | }; 248 | name = Debug; 249 | }; 250 | B34AADD51BFF062E00E9BC3A /* Release */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | ALWAYS_SEARCH_USER_PATHS = NO; 254 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 255 | CLANG_CXX_LIBRARY = "libc++"; 256 | CLANG_ENABLE_MODULES = YES; 257 | CLANG_ENABLE_OBJC_ARC = YES; 258 | CLANG_WARN_BOOL_CONVERSION = YES; 259 | CLANG_WARN_CONSTANT_CONVERSION = YES; 260 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 261 | CLANG_WARN_EMPTY_BODY = YES; 262 | CLANG_WARN_ENUM_CONVERSION = YES; 263 | CLANG_WARN_INT_CONVERSION = YES; 264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 268 | COPY_PHASE_STRIP = NO; 269 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 270 | ENABLE_NS_ASSERTIONS = NO; 271 | ENABLE_STRICT_OBJC_MSGSEND = YES; 272 | GCC_C_LANGUAGE_STANDARD = gnu99; 273 | GCC_NO_COMMON_BLOCKS = YES; 274 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 275 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 276 | GCC_WARN_UNDECLARED_SELECTOR = YES; 277 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 278 | GCC_WARN_UNUSED_FUNCTION = YES; 279 | GCC_WARN_UNUSED_VARIABLE = YES; 280 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 281 | MTL_ENABLE_DEBUG_INFO = NO; 282 | SDKROOT = iphoneos; 283 | TARGETED_DEVICE_FAMILY = "1,2"; 284 | VALIDATE_PRODUCT = YES; 285 | }; 286 | name = Release; 287 | }; 288 | B34AADD71BFF062E00E9BC3A /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | INFOPLIST_FILE = LCNavigationControllerDemo/Info.plist; 293 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 294 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 295 | PRODUCT_BUNDLE_IDENTIFIER = com.leodong.LCNavigationControllerDemo; 296 | PRODUCT_NAME = "$(TARGET_NAME)"; 297 | }; 298 | name = Debug; 299 | }; 300 | B34AADD81BFF062E00E9BC3A /* Release */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 304 | INFOPLIST_FILE = LCNavigationControllerDemo/Info.plist; 305 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 306 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 307 | PRODUCT_BUNDLE_IDENTIFIER = com.leodong.LCNavigationControllerDemo; 308 | PRODUCT_NAME = "$(TARGET_NAME)"; 309 | }; 310 | name = Release; 311 | }; 312 | /* End XCBuildConfiguration section */ 313 | 314 | /* Begin XCConfigurationList section */ 315 | B34AADBA1BFF062E00E9BC3A /* Build configuration list for PBXProject "LCNavigationControllerDemo" */ = { 316 | isa = XCConfigurationList; 317 | buildConfigurations = ( 318 | B34AADD41BFF062E00E9BC3A /* Debug */, 319 | B34AADD51BFF062E00E9BC3A /* Release */, 320 | ); 321 | defaultConfigurationIsVisible = 0; 322 | defaultConfigurationName = Release; 323 | }; 324 | B34AADD61BFF062E00E9BC3A /* Build configuration list for PBXNativeTarget "LCNavigationControllerDemo" */ = { 325 | isa = XCConfigurationList; 326 | buildConfigurations = ( 327 | B34AADD71BFF062E00E9BC3A /* Debug */, 328 | B34AADD81BFF062E00E9BC3A /* Release */, 329 | ); 330 | defaultConfigurationIsVisible = 0; 331 | defaultConfigurationName = Release; 332 | }; 333 | /* End XCConfigurationList section */ 334 | }; 335 | rootObject = B34AADB71BFF062E00E9BC3A /* Project object */; 336 | } 337 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo.xcodeproj/xcuserdata/Leo.xcuserdatad/xcschemes/LCNavigationControllerDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo.xcodeproj/xcuserdata/Leo.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LCNavigationControllerDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B34AADBE1BFF062E00E9BC3A 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo.xcodeproj/xcuserdata/newuser.xcuserdatad/xcschemes/LCNavigationControllerDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo.xcodeproj/xcuserdata/newuser.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LCNavigationControllerDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B34AADBE1BFF062E00E9BC3A 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. 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 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "LCNavigationController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | 21 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 22 | [self.window makeKeyAndVisible]; 23 | 24 | UIViewController *mainVC = [UIStoryboard storyboardWithName:@"Main" bundle:nil].instantiateInitialViewController; 25 | LCNavigationController *navC = [[LCNavigationController alloc] initWithRootViewController:mainVC]; 26 | 27 | self.window.rootViewController = navC; 28 | 29 | return YES; 30 | } 31 | 32 | - (void)applicationWillResignActive:(UIApplication *)application { 33 | // 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. 34 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 35 | } 36 | 37 | - (void)applicationDidEnterBackground:(UIApplication *)application { 38 | // 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. 39 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 40 | } 41 | 42 | - (void)applicationWillEnterForeground:(UIApplication *)application { 43 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 44 | } 45 | 46 | - (void)applicationDidBecomeActive:(UIApplication *)application { 47 | // 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. 48 | } 49 | 50 | - (void)applicationWillTerminate:(UIApplication *)application { 51 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /LCNavigationControllerDemo/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 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 32 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 82 | 94 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 148 | 162 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/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.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/OneVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // OneVC.h 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface OneVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/OneVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // OneVC.m 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. All rights reserved. 7 | // 8 | 9 | #import "OneVC.h" 10 | #import "LCNavigationController.h" 11 | 12 | @interface OneVC () 13 | 14 | @end 15 | 16 | @implementation OneVC 17 | 18 | - (IBAction)pushBtnClicked { 19 | 20 | UIViewController *childVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"TwoVC"]; 21 | [self.lcNavigationController pushViewController:childVC]; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/ThreeVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeVC.h 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ThreeVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/ThreeVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeVC.m 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. All rights reserved. 7 | // 8 | 9 | #import "ThreeVC.h" 10 | #import "LCNavigationController.h" 11 | 12 | @interface ThreeVC () 13 | 14 | @end 15 | 16 | @implementation ThreeVC 17 | 18 | - (IBAction)popBtnClicked { 19 | 20 | [self.lcNavigationController popViewController]; 21 | } 22 | 23 | - (IBAction)popToRootBtnClicked { 24 | 25 | [self.lcNavigationController popToRootViewController]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/TwoVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // TwoVC.h 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TwoVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/TwoVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // TwoVC.m 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. All rights reserved. 7 | // 8 | 9 | #import "TwoVC.h" 10 | #import "LCNavigationController.h" 11 | 12 | @interface TwoVC () 13 | 14 | @end 15 | 16 | @implementation TwoVC 17 | 18 | - (IBAction)popBtnClicked { 19 | 20 | [self.lcNavigationController popViewController]; 21 | } 22 | 23 | - (IBAction)pushBtnClicked { 24 | 25 | UIViewController *childVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ThreeVC"]; 26 | [self.lcNavigationController pushViewController:childVC]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /LCNavigationControllerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LCNavigationControllerDemo 4 | // 5 | // Created by Leo on 15/11/20. 6 | // Copyright © 2015年 Leo. 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 | Copyright (c) 2015 Leo (http://LeoDev.me) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LCNavigationController 2 | 3 | [![Travis](https://img.shields.io/travis/iTofu/LCNavigationController.svg?style=flat)](https://travis-ci.org/iTofu/LCNavigationController) 4 | [![CocoaPods](https://img.shields.io/cocoapods/v/LCNavigationController.svg)](http://cocoadocs.org/docsets/LCNavigationController) 5 | [![CocoaPods](https://img.shields.io/cocoapods/l/LCNavigationController.svg)](https://raw.githubusercontent.com/iTofu/LCNavigationController/master/LICENSE) 6 | [![CocoaPods](https://img.shields.io/cocoapods/p/LCNavigationController.svg)](http://cocoadocs.org/docsets/LCNavigationController) 7 | [![LeoDev](https://img.shields.io/badge/blog-LeoDev.me-brightgreen.svg)](http://leodev.me) 8 | 9 | 除 UINavigationController 外最流行的 NavigationController! 10 | 11 | ![by http://LeoDev.me](https://raw.githubusercontent.com/iTofu/LCNavigationController/master/LCNCDemo.gif) 12 | --- 13 | ![by http://LeoDev.me](https://raw.githubusercontent.com/iTofu/LCNavigationController/master/LCNCDemo.png) 14 | 15 | ```` 16 | In me the tiger sniffs the rose. 17 | 18 | 心有猛虎,细嗅蔷薇。 19 | ```` 20 | 21 | 欢迎访问 **我的博客**:http://LeoDev.me 22 | 23 | 24 | ## 前言 Foreword 25 | 26 | 效果参考 App:腾讯新闻、百度音乐等等 27 | 28 | ⚠️ 项目目前存在一些不足,表现在 viewController 层级相对较多时出现一些卡顿,我会抽空重新思考换一套实现方式,此前不建议集成到大型项目中! 29 | 30 | 31 | 32 | #### 配合`UITabBarController`使用请参考 [tabbar](https://github.com/iTofu/LCNavigationController/tree/tabbar) 分支! 33 | 34 | **效果图:** 35 | 36 | ![by http://LeoDev.me](https://raw.githubusercontent.com/iTofu/LCNavigationController/tabbar/LCNCTabbarDemo.gif) 37 | 38 | 39 | 40 | ## 代码 Code 41 | 42 | > 当成`UINavigationController`来用就行!方法都一样! 43 | > 44 | > 配合`UITabBarController`使用请参考 [tabbar](https://github.com/iTofu/LCNavigationController/tree/tabbar) 分支! 45 | 46 | * 两种导入方法: 47 | - 方法一:[CocoaPods](https://cocoapods.org/) 导入:`pod 'LCNavigationController'` 48 | - 方法二:导入`LCNavigationController`文件夹到你的项目中 (文件夹在 Demo 中可以找到) 49 | 50 | * 在`AppDelegate.m`中,`#import "LCNavigationController.h"`,参考如下代码: 51 | 52 | ````objc 53 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 54 | 55 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 56 | [self.window makeKeyAndVisible]; 57 | 58 | UIViewController *mainVC = [UIStoryboard storyboardWithName:@"Main" bundle:nil].instantiateInitialViewController; 59 | 60 | LCNavigationController *navC = [[LCNavigationController alloc] initWithRootViewController:mainVC]; 61 | 62 | self.window.rootViewController = navC; 63 | 64 | return YES; 65 | } 66 | ```` 67 | 68 | * 在你需要用到的地方`#import "LCNavigationController.h"`,然后: 69 | 70 | ````objc 71 | // 1. Push 72 | UIViewController *childVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"TwoVC"]; 73 | [self.lcNavigationController pushViewController:childVC]; 74 | 75 | // 2. Pop 76 | [self.lcNavigationController popViewController]; 77 | 78 | // 3. Pop to rootViewController 79 | [self.lcNavigationController popToRootViewController]; 80 | ```` 81 | 82 | * 可自定义的参数(在`LCNavigationController.m`中): 83 | 84 | ````objc 85 | static const CGFloat LCAnimationDuration = 0.50f; // Push / Pop 动画持续时间 86 | 87 | static const CGFloat LCMaxBlackMaskAlpha = 0.80f; // 黑色背景透明度 88 | 89 | static const CGFloat LCZoomRatio = 0.90f; // 后面视图缩放比 90 | 91 | static const CGFloat LCShadowOpacity = 0.80f; // 滑动返回时当前视图的阴影透明度 92 | 93 | static const CGFloat LCShadowRadius = 8.00f; // 滑动返回时当前视图的阴影半径 94 | ```` 95 | 96 | * 搞定! 97 | 98 | 99 | ## 更新日志 Update Logs 100 | 101 | ### V 1.0.6 2016.04.05 102 | 103 | * 更新 CocoaPods 源。 104 | 105 | 106 | ### V 1.0.2 2015.11.24 107 | 108 | * 提供配合`UITabBarController`使用的 Demo,详见 [tabbar](https://github.com/iTofu/LCNavigationController/tree/tabbar) 分支。 109 | 110 | * 更新自定义参数。 111 | 112 | 113 | ### V 1.0.0 2015.11.20 114 | 115 | * 初始化提交。 116 | 117 | 118 | 119 | ## 联系 Support 120 | 121 | * 发现问题请 Issue,谢谢:-) 122 | * Mail: devtip@163.com 123 | * Blog: http://LeoDev.me 124 | 125 | 126 | 127 | ## 授权 License 128 | 129 | 本项目采用 [MIT license](http://opensource.org/licenses/MIT) 开源,你可以利用采用该协议的代码做任何事情,只需要继续继承 MIT 协议即可。 130 | --------------------------------------------------------------------------------