├── .gitignore ├── Classes ├── IHParallaxNavigationController.h ├── IHParallaxNavigationController.m ├── IHParallaxViewController.h └── IHParallaxViewController.m ├── Example ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-40.png │ │ ├── Icon-40@2x.png │ │ ├── Icon-40@3x.png │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ ├── Icon-76.png │ │ ├── Icon-76@2x.png │ │ ├── Icon-Small.png │ │ ├── Icon-Small@2x.png │ │ └── Icon-Small@3x.png ├── Info.plist ├── MyParallaxViewController.h ├── MyParallaxViewController.m ├── UIViewController+TransparentNavBar.h ├── UIViewController+TransparentNavBar.m ├── bushpath.jpg ├── main.m └── spacex.jpg ├── IHParallaxNavigationController.podspec ├── IHParallaxNavigationController.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IHParallaxNavigationController.xccheckout ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.xcuserstate 3 | 4 | *.xcbkptlist 5 | 6 | *.xcscheme 7 | 8 | *.plist 9 | 10 | *.xcsettings 11 | -------------------------------------------------------------------------------- /Classes/IHParallaxNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // IHParallaxViewController.h 3 | // IHParallaxNavigationController 4 | // 5 | // Created by Fraser Scott-Morrison on 7/04/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface IHParallaxNavigationController : UINavigationController 12 | 13 | // dont change manually 14 | @property (nonatomic) int currentParallaxLevel; 15 | 16 | // setting the following two properties will ensure your parallax view is scaled correctly to fit 17 | @property (nonatomic) int totalParallaxLevels; // set to total number of screens you're using 18 | @property (nonatomic) int parallaxSpan; 19 | 20 | @property (nonatomic, strong) UIView *floatingView; // you can provide your own custom floating fixed view 21 | @property (nonatomic, strong) UIView *parallaxView; // you can provide your own custom parallax view 22 | - (void)setParallaxImage:(UIImage *)image; // quickly set a UIImage which will be the parallax view 23 | 24 | // static setters for the above properties 25 | + (void)setParallaxImage:(UIImage *)image; 26 | + (void)setParallaxView:(UIView *)parallaxView; 27 | + (void)setFloatingView:(UIView *)floatingView; 28 | + (void)setTotalParallaxLevels:(int)totalParallaxLevels; 29 | + (void)setParallaxSpan:(int)parallaxSpan; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Classes/IHParallaxNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // IHParallaxViewController.m 3 | // IHParallaxNavigationController 4 | // 5 | // Created by Fraser Scott-Morrison on 7/04/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | #import "IHParallaxNavigationController.h" 10 | 11 | @interface IHParallaxNavigationController () 12 | - (void)performParallaxAnimation:(NSNumber *)navLevel; 13 | @end 14 | 15 | static IHParallaxNavigationController *_sharedParallaxNavController = nil; 16 | 17 | @implementation IHParallaxNavigationController 18 | 19 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 20 | { 21 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 22 | if (self) { 23 | // Custom initialization 24 | [self initialize]; 25 | } 26 | return self; 27 | } 28 | 29 | - (id)initWithCoder:(NSCoder *)aDecoder 30 | { 31 | self = [super initWithCoder:(NSCoder *)aDecoder]; 32 | if (self) { 33 | // Custom initialization 34 | [self initialize]; 35 | } 36 | return self; 37 | } 38 | 39 | - (id)init 40 | { 41 | self = [super init]; 42 | if (self) { 43 | // Custom initialization 44 | [self initialize]; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)initialize { 50 | self.currentParallaxLevel = 0; 51 | self.totalParallaxLevels = 2; // change if more than 2 52 | self.parallaxSpan = 30; 53 | _sharedParallaxNavController = self; 54 | } 55 | 56 | - (void)viewDidLoad { 57 | [super viewDidLoad]; 58 | // Do any additional setup after loading the view. 59 | } 60 | 61 | - (void)setParallaxImage:(UIImage *)image { 62 | 63 | CGRect frame = self.view.bounds; 64 | frame.size.width += self.parallaxSpan*self.totalParallaxLevels; 65 | 66 | UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame]; 67 | imageView.image = image; 68 | [imageView setContentMode:UIViewContentModeScaleAspectFill]; 69 | 70 | self.parallaxView = imageView; 71 | } 72 | 73 | - (void)setParallaxView:(UIView *)parallaxView { 74 | if (_parallaxView != nil && _parallaxView.superview != nil) { 75 | [_parallaxView removeFromSuperview]; 76 | } 77 | _parallaxView = parallaxView; 78 | 79 | [self.view addSubview:_parallaxView]; 80 | [self.view sendSubviewToBack:_parallaxView]; 81 | } 82 | 83 | - (void)setFloatingView:(UIView *)floatingView { 84 | if (_floatingView != nil && _floatingView.superview != nil) { 85 | [_floatingView removeFromSuperview]; 86 | } 87 | _floatingView = floatingView; 88 | 89 | _floatingView.userInteractionEnabled = NO; 90 | [self.view addSubview:_floatingView]; 91 | [self.view sendSubviewToBack:_floatingView]; 92 | [self.view sendSubviewToBack:_parallaxView]; 93 | } 94 | 95 | - (void)performParallaxAnimation:(NSNumber *)navLevel { 96 | 97 | 98 | int parallaxDistance = [navLevel intValue] * self.parallaxSpan; 99 | float duration = [navLevel intValue] > self.currentParallaxLevel ? 0.4 : 0.2; 100 | 101 | if (self.currentParallaxLevel != [navLevel intValue]) { 102 | [UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 103 | self.parallaxView.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, -parallaxDistance, 0); 104 | } completion:^(BOOL finish){}]; 105 | } 106 | 107 | self.currentParallaxLevel = [navLevel intValue]; 108 | } 109 | 110 | #pragma - mark static methods 111 | 112 | + (void)setParallaxImage:(UIImage *)image { 113 | [_sharedParallaxNavController setParallaxImage:image]; 114 | } 115 | + (void)setParallaxView:(UIView *)parallaxView { 116 | [_sharedParallaxNavController setParallaxView:parallaxView]; 117 | } 118 | + (void)setFloatingView:(UIView *)floatingView { 119 | [_sharedParallaxNavController setFloatingView:floatingView]; 120 | } 121 | + (void)setTotalParallaxLevels:(int)totalParallaxLevels { 122 | [_sharedParallaxNavController setTotalParallaxLevels:totalParallaxLevels]; 123 | } 124 | + (void)setParallaxSpan:(int)parallaxSpan { 125 | [_sharedParallaxNavController setParallaxSpan:parallaxSpan]; 126 | } 127 | 128 | @end 129 | -------------------------------------------------------------------------------- /Classes/IHParallaxViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // IHParallaxViewController.h 3 | // IHParallaxNavigationController 4 | // 5 | // Created by Fraser Scott-Morrison on 7/04/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface IHParallaxViewController : UIViewController 12 | 13 | @property (nonatomic, strong) UIColor *customNavBarColor; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Classes/IHParallaxViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // IHParallaxViewController.m 3 | // IHParallaxNavigationController 4 | // 5 | // Created by Fraser Scott-Morrison on 7/04/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | #import "IHParallaxViewController.h" 10 | 11 | @interface IHParallaxViewController () 12 | @end 13 | 14 | @implementation IHParallaxViewController 15 | 16 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 17 | { 18 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 19 | if (self) { 20 | // Custom initialization 21 | [self initialize]; 22 | } 23 | return self; 24 | } 25 | 26 | - (id)initWithCoder:(NSCoder *)aDecoder 27 | { 28 | self = [super initWithCoder:(NSCoder *)aDecoder]; 29 | if (self) { 30 | // Custom initialization 31 | [self initialize]; 32 | } 33 | return self; 34 | } 35 | 36 | - (id)init 37 | { 38 | self = [super init]; 39 | if (self) { 40 | // Custom initialization 41 | [self initialize]; 42 | } 43 | return self; 44 | } 45 | 46 | - (void)initialize { 47 | self.customNavBarColor = [UIColor clearColor]; // clearColor gives a transparent nav bar 48 | } 49 | 50 | - (void)viewDidLoad { 51 | [super viewDidLoad]; 52 | 53 | self.view.backgroundColor = [UIColor clearColor]; 54 | } 55 | 56 | #pragma clang diagnostic push 57 | #pragma clang diagnostic ignored "-Wundeclared-selector" 58 | 59 | - (void)viewWillAppear:(BOOL)animated { 60 | [super viewWillAppear:animated]; 61 | 62 | if ([self.navigationController respondsToSelector:@selector(performParallaxAnimation:)]) { 63 | [self.navigationController performSelector:@selector(performParallaxAnimation:) withObject:[NSNumber numberWithInteger:self.navigationController.viewControllers.count - 1]]; 64 | } 65 | 66 | [UIView beginAnimations:nil context:nil]; 67 | [UIView setAnimationDuration:0.3]; 68 | [UIView setAnimationDelegate:self]; 69 | [UIView setAnimationDidStopSelector:@selector(viewWillAppearAnimationFinished)]; 70 | self.view.alpha = 1; 71 | [UIView commitAnimations]; 72 | } 73 | 74 | - (void)viewWillAppearAnimationFinished { 75 | CGPoint viewOrigin = [self.view convertPoint:self.view.frame.origin toView:self.navigationController.view]; 76 | if (viewOrigin.x < 0) { 77 | self.view.alpha = 0; 78 | } 79 | } 80 | 81 | - (void)viewDidAppear:(BOOL)animated { 82 | [super viewDidAppear:animated]; 83 | 84 | if ([self.navigationController respondsToSelector:@selector(performParallaxAnimation:)]) { 85 | [self.navigationController performSelector:@selector(performParallaxAnimation:) withObject:[NSNumber numberWithInteger:self.navigationController.viewControllers.count - 1]]; 86 | } 87 | 88 | self.view.alpha = 1; 89 | } 90 | 91 | #pragma clang diagnostic pop 92 | 93 | - (void)viewWillDisappear:(BOOL)animated { 94 | [super viewWillDisappear:animated]; 95 | 96 | [UIView beginAnimations:nil context:nil]; 97 | [UIView setAnimationDuration:0.3]; 98 | [UIView setAnimationDelegate:self]; 99 | [UIView setAnimationDidStopSelector:@selector(viewWillDisappearAnimationFinished)]; 100 | self.view.alpha = 0; 101 | [UIView commitAnimations]; 102 | } 103 | 104 | - (void)viewWillDisappearAnimationFinished { 105 | CGPoint viewOrigin = [self.view convertPoint:self.view.frame.origin toView:self.navigationController.view]; 106 | if (viewOrigin.x < 0) { 107 | self.view.alpha = 0; 108 | } 109 | else { 110 | self.view.alpha = 1; 111 | } 112 | } 113 | 114 | - (void)viewDidDisappear:(BOOL)animated { 115 | [super viewDidDisappear:animated]; 116 | 117 | self.view.alpha = 0; 118 | } 119 | 120 | 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // IHParallaxNavigationController 4 | // 5 | // Created by Fraser Scott-Morrison on 7/04/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // IHParallaxNavigationController 4 | // 5 | // Created by Fraser Scott-Morrison on 7/04/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "IHParallaxNavigationController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | 20 | // set an image for the parallax background 21 | NSString *randomBackgroundImage; 22 | NSUInteger r = arc4random_uniform(2); 23 | switch (r) { 24 | case 0: 25 | randomBackgroundImage = @"bushpath.jpg"; 26 | break; 27 | case 1: 28 | randomBackgroundImage = @"spacex.jpg"; 29 | default: 30 | break; 31 | } 32 | [IHParallaxNavigationController setParallaxImage:[UIImage imageNamed:randomBackgroundImage]]; 33 | 34 | [IHParallaxNavigationController setTotalParallaxLevels:4]; 35 | [IHParallaxNavigationController setParallaxSpan:50]; 36 | 37 | // alternatively set any custom view for the parallax background 38 | //[IHParallaxNavigationController setParallaxView:[[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]]; 39 | //self.parallaxView = [[UIView alloc] initWithFrame:self.view.bounds]; 40 | 41 | // initialize a view that is fixed and floats above the parallax background image 42 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(([UIScreen mainScreen].bounds.size.width-300)/2, 96, 300, 38)]; 43 | label.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5]; 44 | label.textAlignment = NSTextAlignmentCenter; 45 | label.text = @"IHParallax Navigation Controller"; 46 | label.textColor = [UIColor lightGrayColor]; 47 | label.font = [UIFont systemFontOfSize:20]; 48 | [IHParallaxNavigationController setFloatingView:label]; 49 | 50 | // appearance 51 | NSDictionary *attributes = @{NSForegroundColorAttributeName:[UIColor colorWithRed:60/255.0 green:154/255.0 blue:188/255.0 alpha:1]}; 52 | [[UIBarButtonItem appearance] setTitleTextAttributes:attributes forState:UIControlStateNormal]; 53 | [[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:60/255.0 green:154/255.0 blue:188/255.0 alpha:1]]; 54 | 55 | return YES; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Example/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 37 | 38 | 39 | 40 | 149 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 228 | 229 | 230 | 231 | 336 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 407 | 408 | 409 | 410 | 502 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 622 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x", 7 | "filename" : "Icon-Small@2x.png" 8 | }, 9 | { 10 | "idiom" : "iphone", 11 | "size" : "29x29", 12 | "scale" : "3x", 13 | "filename" : "Icon-Small@3x.png" 14 | }, 15 | { 16 | "idiom" : "iphone", 17 | "size" : "40x40", 18 | "scale" : "2x", 19 | "filename" : "Icon-40@2x.png" 20 | }, 21 | { 22 | "idiom" : "iphone", 23 | "size" : "40x40", 24 | "scale" : "3x", 25 | "filename" : "Icon-40@3x.png" 26 | }, 27 | { 28 | "idiom" : "iphone", 29 | "size" : "60x60", 30 | "scale" : "2x", 31 | "filename" : "Icon-60@2x.png" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "3x", 37 | "filename" : "Icon-60@3x.png" 38 | }, 39 | { 40 | "idiom" : "ipad", 41 | "size" : "29x29", 42 | "scale" : "1x", 43 | "filename" : "Icon-Small.png" 44 | }, 45 | { 46 | "idiom" : "ipad", 47 | "size" : "29x29", 48 | "scale" : "2x", 49 | "filename" : "Icon-Small@2x.png" 50 | }, 51 | { 52 | "idiom" : "ipad", 53 | "size" : "40x40", 54 | "scale" : "1x", 55 | "filename" : "Icon-40.png" 56 | }, 57 | { 58 | "idiom" : "ipad", 59 | "size" : "40x40", 60 | "scale" : "2x", 61 | "filename" : "Icon-40@2x.png" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "76x76", 66 | "scale" : "1x", 67 | "filename" : "Icon-76.png" 68 | }, 69 | { 70 | "idiom" : "ipad", 71 | "size" : "76x76", 72 | "scale" : "2x", 73 | "filename" : "Icon-76@2x.png" 74 | } 75 | ], 76 | "info" : { 77 | "version" : 1, 78 | "author" : "makeappicon" 79 | } 80 | } -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-40.png -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-Small.png -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /Example/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | IH.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.3 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarHidden 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/MyParallaxViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyParallaxViewController.h 3 | // IHParallaxNavigationController 4 | // 5 | // Created by Fraser Scott-Morrison on 5/05/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | #import "IHParallaxViewController.h" 10 | 11 | @interface MyParallaxViewController : IHParallaxViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/MyParallaxViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyParallaxViewController.m 3 | // IHParallaxNavigationController 4 | // 5 | // Created by Fraser Scott-Morrison on 5/05/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | #import "MyParallaxViewController.h" 10 | #import "UIViewController+TransparentNavBar.h" 11 | 12 | @interface MyParallaxViewController () 13 | 14 | @end 15 | 16 | @implementation MyParallaxViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view. 21 | } 22 | 23 | - (void)viewWillAppear:(BOOL)animated { 24 | [super viewWillAppear:animated]; 25 | 26 | [self setNavBarColor:self.customNavBarColor]; 27 | } 28 | 29 | - (void)didReceiveMemoryWarning { 30 | [super didReceiveMemoryWarning]; 31 | // Dispose of any resources that can be recreated. 32 | } 33 | 34 | /* 35 | #pragma mark - Navigation 36 | 37 | // In a storyboard-based application, you will often want to do a little preparation before navigation 38 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 39 | // Get the new view controller using [segue destinationViewController]. 40 | // Pass the selected object to the new view controller. 41 | } 42 | */ 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Example/UIViewController+TransparentNavBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+TransparentNavBar 3 | // UIViewController+TransparentNavBar 4 | // 5 | // Created by Fraser Scott-Morrison on 7/04/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | 10 | // available from https://github.com/IdleHandsApps/UIViewController-TransparentNavBar 11 | // import with: pod 'UIViewController-TransparentNavBar' 12 | 13 | #import 14 | 15 | @interface UIViewController (TransparentNavBar) 16 | 17 | - (void)setNavBarColor:(UIColor *)navBarColor; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/UIViewController+TransparentNavBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+TransparentNavBar 3 | // UIViewController+TransparentNavBar 4 | // 5 | // Created by Fraser Scott-Morrison on 7/04/15. 6 | // Copyright (c) 2015 Idle Hands. All rights reserved. 7 | // 8 | 9 | // available from https://github.com/IdleHandsApps/UIViewController-TransparentNavBar 10 | // import with: pod 'UIViewController-TransparentNavBar' 11 | 12 | #import "UIViewController+TransparentNavBar.h" 13 | 14 | @implementation UIViewController (TransparentNavBar) 15 | 16 | - (void)setNavBarColor:(UIColor *)navBarColor { 17 | static UIImage *shadowImage; 18 | 19 | if (navBarColor && CGColorGetAlpha(navBarColor.CGColor) == 0) { 20 | // if transparent color then use transparent nav bar 21 | [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; 22 | shadowImage = self.navigationController.navigationBar.shadowImage; 23 | self.navigationController.navigationBar.shadowImage = [UIImage new]; 24 | } 25 | else if (navBarColor){ 26 | // use custom color 27 | [self.navigationController.navigationBar setBackgroundImage:[self imageWithColor:navBarColor] forBarMetrics:UIBarMetricsDefault]; 28 | self.navigationController.navigationBar.shadowImage = shadowImage; 29 | } 30 | else { 31 | // restore original nav bar color 32 | [self.navigationController.navigationBar setBackgroundImage:[self imageWithColor:[UIColor colorWithRed:220/255.0 green:220/255.0 blue:220/255.0 alpha:1]] forBarMetrics:UIBarMetricsDefault]; 33 | self.navigationController.navigationBar.shadowImage = shadowImage; 34 | } 35 | } 36 | 37 | - (UIImage *)imageWithColor:(UIColor *)color { 38 | 39 | CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 40 | UIGraphicsBeginImageContext(rect.size); 41 | CGContextRef context = UIGraphicsGetCurrentContext(); 42 | 43 | CGContextSetFillColorWithColor(context, [color CGColor]); 44 | CGContextFillRect(context, rect); 45 | 46 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 47 | UIGraphicsEndImageContext(); 48 | 49 | return image; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Example/bushpath.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/bushpath.jpg -------------------------------------------------------------------------------- /Example/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // IHParallaxNavigationController 4 | // 5 | // Created by Fraser Scott-Morrison on 7/04/15. 6 | // Copyright (c) 2015 Idle Hands. 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 | -------------------------------------------------------------------------------- /Example/spacex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IdleHandsApps/IHParallaxNavigationController/471c36504cf98f9465d2bf7f228276fddbf2952a/Example/spacex.jpg -------------------------------------------------------------------------------- /IHParallaxNavigationController.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'IHParallaxNavigationController' 3 | s.version = '1.3' 4 | s.summary = 'IHParallaxNavigationController is a UINavigationController subclass that uses a parallax effect when pushing and popping view controllers' 5 | s.homepage = 'https://github.com/IdleHandsApps/IHParallaxNavigationController/' 6 | s.description = <<-DESC 7 | IHParallaxNavigationController is a drop in solution to give you a cool parallax effect when pushing and popping view controllers. Its compatible with Storyboards and requires very little code. 8 | 9 | In your storyboard, just change the UINavigationController class to IHParallaxNavigationController and your UIViewControllers to IHParallaxViewController, then in code set the parallax background image and you are done 10 | 11 | All animations, transitions and gestures automatically performed by UINavigationControllers are supported by IHParallaxNavigationController as its a subclass 12 | DESC 13 | s.license = 'MIT' 14 | s.author = { 'Fraser Scott-Morrison' => 'fraserscottmorrison@me.com' } 15 | s.source = { :git => 'https://github.com/IdleHandsApps/IHParallaxNavigationController.git', :tag => s.version.to_s } 16 | s.platform = :ios, '5.0' 17 | s.source_files = 'Classes/*.{h,m}' 18 | s.public_header_files = 'Classes/*.h' 19 | 20 | s.ios.deployment_target = '5.0' 21 | s.requires_arc = true 22 | end 23 | -------------------------------------------------------------------------------- /IHParallaxNavigationController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4C2ECF221AF870A600B1A4A2 /* MyParallaxViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C2ECF211AF870A600B1A4A2 /* MyParallaxViewController.m */; }; 11 | 4C2ECF251AF870EF00B1A4A2 /* UIViewController+TransparentNavBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C2ECF241AF870EF00B1A4A2 /* UIViewController+TransparentNavBar.m */; }; 12 | 4C3BC5011AD39BE9007B7227 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3BC4F71AD39BE9007B7227 /* AppDelegate.m */; }; 13 | 4C3BC5021AD39BE9007B7227 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C3BC4F81AD39BE9007B7227 /* LaunchScreen.xib */; }; 14 | 4C3BC5041AD39BE9007B7227 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4C3BC4FC1AD39BE9007B7227 /* Images.xcassets */; }; 15 | 4C3BC5051AD39BE9007B7227 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4C3BC4FD1AD39BE9007B7227 /* Info.plist */; }; 16 | 4C3BC5061AD39BE9007B7227 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3BC4FE1AD39BE9007B7227 /* main.m */; }; 17 | 4C3BC50C1AD39C60007B7227 /* IHParallaxNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3BC5091AD39C60007B7227 /* IHParallaxNavigationController.m */; }; 18 | 4C3BC50D1AD39C60007B7227 /* IHParallaxViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3BC50B1AD39C60007B7227 /* IHParallaxViewController.m */; }; 19 | 4C3BC5121AD4CDA4007B7227 /* spacex.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 4C3BC5111AD4CDA4007B7227 /* spacex.jpg */; }; 20 | 4C7E32321AE4684200D6F089 /* bushpath.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 4C7E32311AE4684200D6F089 /* bushpath.jpg */; }; 21 | 4C99DE561AD4D9AD00D02484 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4C99DE541AD4D9AD00D02484 /* Main.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 4C2ECF201AF870A600B1A4A2 /* MyParallaxViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyParallaxViewController.h; sourceTree = ""; }; 26 | 4C2ECF211AF870A600B1A4A2 /* MyParallaxViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyParallaxViewController.m; sourceTree = ""; }; 27 | 4C2ECF231AF870EF00B1A4A2 /* UIViewController+TransparentNavBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+TransparentNavBar.h"; sourceTree = ""; }; 28 | 4C2ECF241AF870EF00B1A4A2 /* UIViewController+TransparentNavBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+TransparentNavBar.m"; sourceTree = ""; }; 29 | 4C3BC4CB1AD39AC9007B7227 /* IHParallaxNavigationController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IHParallaxNavigationController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 4C3BC4F61AD39BE9007B7227 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 31 | 4C3BC4F71AD39BE9007B7227 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 32 | 4C3BC4F91AD39BE9007B7227 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 33 | 4C3BC4FC1AD39BE9007B7227 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 34 | 4C3BC4FD1AD39BE9007B7227 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 4C3BC4FE1AD39BE9007B7227 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 4C3BC5081AD39C60007B7227 /* IHParallaxNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IHParallaxNavigationController.h; path = Classes/IHParallaxNavigationController.h; sourceTree = SOURCE_ROOT; }; 37 | 4C3BC5091AD39C60007B7227 /* IHParallaxNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IHParallaxNavigationController.m; path = Classes/IHParallaxNavigationController.m; sourceTree = SOURCE_ROOT; }; 38 | 4C3BC50A1AD39C60007B7227 /* IHParallaxViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IHParallaxViewController.h; path = Classes/IHParallaxViewController.h; sourceTree = SOURCE_ROOT; }; 39 | 4C3BC50B1AD39C60007B7227 /* IHParallaxViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IHParallaxViewController.m; path = Classes/IHParallaxViewController.m; sourceTree = SOURCE_ROOT; }; 40 | 4C3BC5111AD4CDA4007B7227 /* spacex.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = spacex.jpg; sourceTree = ""; }; 41 | 4C7E32311AE4684200D6F089 /* bushpath.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = bushpath.jpg; sourceTree = ""; }; 42 | 4C7E32361AE4881E00D6F089 /* IHParallaxNavigationController.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = IHParallaxNavigationController.podspec; sourceTree = SOURCE_ROOT; }; 43 | 4C7E32371AE4A64D00D6F089 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; 44 | 4C99DE551AD4D9AD00D02484 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 4C3BC4C81AD39AC9007B7227 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 4C3BC4C21AD39AC9007B7227 = { 59 | isa = PBXGroup; 60 | children = ( 61 | 4C3BC4CD1AD39AC9007B7227 /* IHParallaxNavigationController */, 62 | 4C3BC4F51AD39BE9007B7227 /* IHParallaxNavigationControllerDemo */, 63 | 4C3BC4CC1AD39AC9007B7227 /* Products */, 64 | ); 65 | sourceTree = ""; 66 | }; 67 | 4C3BC4CC1AD39AC9007B7227 /* Products */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 4C3BC4CB1AD39AC9007B7227 /* IHParallaxNavigationController.app */, 71 | ); 72 | name = Products; 73 | sourceTree = ""; 74 | }; 75 | 4C3BC4CD1AD39AC9007B7227 /* IHParallaxNavigationController */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 4C3BC5081AD39C60007B7227 /* IHParallaxNavigationController.h */, 79 | 4C3BC5091AD39C60007B7227 /* IHParallaxNavigationController.m */, 80 | 4C3BC50A1AD39C60007B7227 /* IHParallaxViewController.h */, 81 | 4C3BC50B1AD39C60007B7227 /* IHParallaxViewController.m */, 82 | ); 83 | name = IHParallaxNavigationController; 84 | path = IHParallaxBackground; 85 | sourceTree = ""; 86 | }; 87 | 4C3BC4F51AD39BE9007B7227 /* IHParallaxNavigationControllerDemo */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 4C3BC4F61AD39BE9007B7227 /* AppDelegate.h */, 91 | 4C3BC4F71AD39BE9007B7227 /* AppDelegate.m */, 92 | 4C2ECF201AF870A600B1A4A2 /* MyParallaxViewController.h */, 93 | 4C2ECF211AF870A600B1A4A2 /* MyParallaxViewController.m */, 94 | 4C2ECF231AF870EF00B1A4A2 /* UIViewController+TransparentNavBar.h */, 95 | 4C2ECF241AF870EF00B1A4A2 /* UIViewController+TransparentNavBar.m */, 96 | 4C3BC4F81AD39BE9007B7227 /* LaunchScreen.xib */, 97 | 4C99DE541AD4D9AD00D02484 /* Main.storyboard */, 98 | 4C3BC4FC1AD39BE9007B7227 /* Images.xcassets */, 99 | 4C7E32361AE4881E00D6F089 /* IHParallaxNavigationController.podspec */, 100 | 4C7E32371AE4A64D00D6F089 /* README.md */, 101 | 4C3BC4FD1AD39BE9007B7227 /* Info.plist */, 102 | 4C3BC4FE1AD39BE9007B7227 /* main.m */, 103 | 4C3BC5111AD4CDA4007B7227 /* spacex.jpg */, 104 | 4C7E32311AE4684200D6F089 /* bushpath.jpg */, 105 | ); 106 | name = IHParallaxNavigationControllerDemo; 107 | path = Example; 108 | sourceTree = SOURCE_ROOT; 109 | }; 110 | /* End PBXGroup section */ 111 | 112 | /* Begin PBXNativeTarget section */ 113 | 4C3BC4CA1AD39AC9007B7227 /* IHParallaxNavigationController */ = { 114 | isa = PBXNativeTarget; 115 | buildConfigurationList = 4C3BC4EE1AD39AC9007B7227 /* Build configuration list for PBXNativeTarget "IHParallaxNavigationController" */; 116 | buildPhases = ( 117 | 4C3BC4C71AD39AC9007B7227 /* Sources */, 118 | 4C3BC4C81AD39AC9007B7227 /* Frameworks */, 119 | 4C3BC4C91AD39AC9007B7227 /* Resources */, 120 | ); 121 | buildRules = ( 122 | ); 123 | dependencies = ( 124 | ); 125 | name = IHParallaxNavigationController; 126 | productName = IHParallaxBackground; 127 | productReference = 4C3BC4CB1AD39AC9007B7227 /* IHParallaxNavigationController.app */; 128 | productType = "com.apple.product-type.application"; 129 | }; 130 | /* End PBXNativeTarget section */ 131 | 132 | /* Begin PBXProject section */ 133 | 4C3BC4C31AD39AC9007B7227 /* Project object */ = { 134 | isa = PBXProject; 135 | attributes = { 136 | LastUpgradeCheck = 0620; 137 | ORGANIZATIONNAME = "Idle Hands"; 138 | TargetAttributes = { 139 | 4C3BC4CA1AD39AC9007B7227 = { 140 | CreatedOnToolsVersion = 6.2; 141 | }; 142 | }; 143 | }; 144 | buildConfigurationList = 4C3BC4C61AD39AC9007B7227 /* Build configuration list for PBXProject "IHParallaxNavigationController" */; 145 | compatibilityVersion = "Xcode 3.2"; 146 | developmentRegion = English; 147 | hasScannedForEncodings = 0; 148 | knownRegions = ( 149 | en, 150 | Base, 151 | ); 152 | mainGroup = 4C3BC4C21AD39AC9007B7227; 153 | productRefGroup = 4C3BC4CC1AD39AC9007B7227 /* Products */; 154 | projectDirPath = ""; 155 | projectRoot = ""; 156 | targets = ( 157 | 4C3BC4CA1AD39AC9007B7227 /* IHParallaxNavigationController */, 158 | ); 159 | }; 160 | /* End PBXProject section */ 161 | 162 | /* Begin PBXResourcesBuildPhase section */ 163 | 4C3BC4C91AD39AC9007B7227 /* Resources */ = { 164 | isa = PBXResourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | 4C3BC5021AD39BE9007B7227 /* LaunchScreen.xib in Resources */, 168 | 4C99DE561AD4D9AD00D02484 /* Main.storyboard in Resources */, 169 | 4C3BC5041AD39BE9007B7227 /* Images.xcassets in Resources */, 170 | 4C3BC5051AD39BE9007B7227 /* Info.plist in Resources */, 171 | 4C7E32321AE4684200D6F089 /* bushpath.jpg in Resources */, 172 | 4C3BC5121AD4CDA4007B7227 /* spacex.jpg in Resources */, 173 | ); 174 | runOnlyForDeploymentPostprocessing = 0; 175 | }; 176 | /* End PBXResourcesBuildPhase section */ 177 | 178 | /* Begin PBXSourcesBuildPhase section */ 179 | 4C3BC4C71AD39AC9007B7227 /* Sources */ = { 180 | isa = PBXSourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 4C2ECF221AF870A600B1A4A2 /* MyParallaxViewController.m in Sources */, 184 | 4C2ECF251AF870EF00B1A4A2 /* UIViewController+TransparentNavBar.m in Sources */, 185 | 4C3BC50C1AD39C60007B7227 /* IHParallaxNavigationController.m in Sources */, 186 | 4C3BC5061AD39BE9007B7227 /* main.m in Sources */, 187 | 4C3BC5011AD39BE9007B7227 /* AppDelegate.m in Sources */, 188 | 4C3BC50D1AD39C60007B7227 /* IHParallaxViewController.m in Sources */, 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | }; 192 | /* End PBXSourcesBuildPhase section */ 193 | 194 | /* Begin PBXVariantGroup section */ 195 | 4C3BC4F81AD39BE9007B7227 /* LaunchScreen.xib */ = { 196 | isa = PBXVariantGroup; 197 | children = ( 198 | 4C3BC4F91AD39BE9007B7227 /* Base */, 199 | ); 200 | name = LaunchScreen.xib; 201 | sourceTree = ""; 202 | }; 203 | 4C99DE541AD4D9AD00D02484 /* Main.storyboard */ = { 204 | isa = PBXVariantGroup; 205 | children = ( 206 | 4C99DE551AD4D9AD00D02484 /* Base */, 207 | ); 208 | name = Main.storyboard; 209 | sourceTree = ""; 210 | }; 211 | /* End PBXVariantGroup section */ 212 | 213 | /* Begin XCBuildConfiguration section */ 214 | 4C3BC4EC1AD39AC9007B7227 /* Debug */ = { 215 | isa = XCBuildConfiguration; 216 | buildSettings = { 217 | ALWAYS_SEARCH_USER_PATHS = NO; 218 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 219 | CLANG_CXX_LIBRARY = "libc++"; 220 | CLANG_ENABLE_MODULES = YES; 221 | CLANG_ENABLE_OBJC_ARC = YES; 222 | CLANG_WARN_BOOL_CONVERSION = YES; 223 | CLANG_WARN_CONSTANT_CONVERSION = YES; 224 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 225 | CLANG_WARN_EMPTY_BODY = YES; 226 | CLANG_WARN_ENUM_CONVERSION = YES; 227 | CLANG_WARN_INT_CONVERSION = YES; 228 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 229 | CLANG_WARN_UNREACHABLE_CODE = YES; 230 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 231 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 232 | COPY_PHASE_STRIP = NO; 233 | ENABLE_STRICT_OBJC_MSGSEND = YES; 234 | GCC_C_LANGUAGE_STANDARD = gnu99; 235 | GCC_DYNAMIC_NO_PIC = NO; 236 | GCC_OPTIMIZATION_LEVEL = 0; 237 | GCC_PREPROCESSOR_DEFINITIONS = ( 238 | "DEBUG=1", 239 | "$(inherited)", 240 | ); 241 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 242 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 243 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 244 | GCC_WARN_UNDECLARED_SELECTOR = YES; 245 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 246 | GCC_WARN_UNUSED_FUNCTION = YES; 247 | GCC_WARN_UNUSED_VARIABLE = YES; 248 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 249 | MTL_ENABLE_DEBUG_INFO = YES; 250 | ONLY_ACTIVE_ARCH = YES; 251 | SDKROOT = iphoneos; 252 | TARGETED_DEVICE_FAMILY = "1,2"; 253 | }; 254 | name = Debug; 255 | }; 256 | 4C3BC4ED1AD39AC9007B7227 /* Release */ = { 257 | isa = XCBuildConfiguration; 258 | buildSettings = { 259 | ALWAYS_SEARCH_USER_PATHS = NO; 260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 261 | CLANG_CXX_LIBRARY = "libc++"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_WARN_BOOL_CONVERSION = YES; 265 | CLANG_WARN_CONSTANT_CONVERSION = YES; 266 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 267 | CLANG_WARN_EMPTY_BODY = YES; 268 | CLANG_WARN_ENUM_CONVERSION = YES; 269 | CLANG_WARN_INT_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_UNREACHABLE_CODE = YES; 272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 273 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 274 | COPY_PHASE_STRIP = NO; 275 | ENABLE_NS_ASSERTIONS = NO; 276 | ENABLE_STRICT_OBJC_MSGSEND = YES; 277 | GCC_C_LANGUAGE_STANDARD = gnu99; 278 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 279 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 280 | GCC_WARN_UNDECLARED_SELECTOR = YES; 281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 282 | GCC_WARN_UNUSED_FUNCTION = YES; 283 | GCC_WARN_UNUSED_VARIABLE = YES; 284 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 285 | MTL_ENABLE_DEBUG_INFO = NO; 286 | SDKROOT = iphoneos; 287 | TARGETED_DEVICE_FAMILY = "1,2"; 288 | VALIDATE_PRODUCT = YES; 289 | }; 290 | name = Release; 291 | }; 292 | 4C3BC4EF1AD39AC9007B7227 /* Debug */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 296 | INFOPLIST_FILE = Example/Info.plist; 297 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 298 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | }; 301 | name = Debug; 302 | }; 303 | 4C3BC4F01AD39AC9007B7227 /* Release */ = { 304 | isa = XCBuildConfiguration; 305 | buildSettings = { 306 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 307 | INFOPLIST_FILE = Example/Info.plist; 308 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 309 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | }; 312 | name = Release; 313 | }; 314 | /* End XCBuildConfiguration section */ 315 | 316 | /* Begin XCConfigurationList section */ 317 | 4C3BC4C61AD39AC9007B7227 /* Build configuration list for PBXProject "IHParallaxNavigationController" */ = { 318 | isa = XCConfigurationList; 319 | buildConfigurations = ( 320 | 4C3BC4EC1AD39AC9007B7227 /* Debug */, 321 | 4C3BC4ED1AD39AC9007B7227 /* Release */, 322 | ); 323 | defaultConfigurationIsVisible = 0; 324 | defaultConfigurationName = Release; 325 | }; 326 | 4C3BC4EE1AD39AC9007B7227 /* Build configuration list for PBXNativeTarget "IHParallaxNavigationController" */ = { 327 | isa = XCConfigurationList; 328 | buildConfigurations = ( 329 | 4C3BC4EF1AD39AC9007B7227 /* Debug */, 330 | 4C3BC4F01AD39AC9007B7227 /* Release */, 331 | ); 332 | defaultConfigurationIsVisible = 0; 333 | defaultConfigurationName = Release; 334 | }; 335 | /* End XCConfigurationList section */ 336 | }; 337 | rootObject = 4C3BC4C31AD39AC9007B7227 /* Project object */; 338 | } 339 | -------------------------------------------------------------------------------- /IHParallaxNavigationController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /IHParallaxNavigationController.xcodeproj/project.xcworkspace/xcshareddata/IHParallaxNavigationController.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 5F07D6B7-626E-46F3-8EA3-B4867D0370BA 9 | IDESourceControlProjectName 10 | IHParallaxNavigationController 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | FC54E44862DB156EDE3DA58A95C2D1923BF27F88 14 | https://github.com/IdleHandsApps/IHParallaxNavigationController.git 15 | 16 | IDESourceControlProjectPath 17 | IHParallaxNavigationController.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | FC54E44862DB156EDE3DA58A95C2D1923BF27F88 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/IdleHandsApps/IHParallaxNavigationController.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | FC54E44862DB156EDE3DA58A95C2D1923BF27F88 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | FC54E44862DB156EDE3DA58A95C2D1923BF27F88 36 | IDESourceControlWCCName 37 | IHParallaxNavigationController 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2013 Fraser Scott-Morrison 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 13 | all 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 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![alt icon](https://github.com/IdleHandsApps/IHParallaxNavigationController/blob/gh-pages/Icon-40.png) IHParallaxNavigationController 2 | ------------------------------ 3 | A drop in UINavigationController subclass that uses a parallax effect when pushing and popping view controllers 4 | 5 | ![alt demo](https://github.com/IdleHandsApps/IHParallaxNavigationController/blob/gh-pages/IHParallaxNavigationControllerDemo.gif) 6 | 7 | ## Description 8 | 9 | IHParallaxNavigationController is a drop in solution to give you a cool parallax effect when pushing and popping view controllers. Its compatible with Storyboards and requires very little code. 10 | 11 | In your storyboard, just change the UINavigationController class to IHParallaxNavigationController and your UIViewControllers to IHParallaxViewControllers, then in code set the parallax background image and you are done 12 | 13 | IHParallaxNavigationController is a sublass of UINavigationController so all standard animations, transitions and gestures are supported. 14 | 15 | ## How to install 16 | 17 | Add this to your CocoaPods Podfile. 18 | ``` 19 | pod 'IHParallaxNavigationController' 20 | ``` 21 | 22 | ## How to use 23 | 24 | Using storyboards: 25 | 26 | Change your UINavigationController to a IHParallaxNavigationController 27 | Then change your UIViewControllers to IHParallaxViewControllers 28 | Then just call ```setParallaxImage:(UIImage *)image``` to set the background parallax view 29 | 30 | Without storyboards: 31 | 32 | Initialise the navigation controller 33 | ```objective-c 34 | IHParallaxNavigationController *parallaxNavController = [[IHParallaxNavigationController alloc] initWithRootViewController:rootController]; 35 | [parallaxNavController setParallaxImage:[UIImage imageNamed:@"my_img"]]; 36 | ``` 37 | 38 | When you add a view controller to the navigation stack, ensure its a subclass of IHParallaxViewController 39 | ```objective-c 40 | IHParallaxViewController *parallaxController = [[IHParallaxViewController alloc] init]; 41 | [parallaxNavController pushViewController:parallaxController animated:YES]; 42 | ``` 43 | 44 | Optional methods 45 | 46 | Set totalParallaxLevels to the maximum number of UIParallaxViewControllers in your navigation stack, to ensure your background parallax view is scaled correctly (default is 2) 47 | 48 | Set parallaxSpan to to change the displacement of each transition (default is 30). Setting parallaxSpan=0 will disable the parallax effect 49 | 50 | Set customNavBar color to: nil=grey, clearColor=transparent, or any UIColor of you choice (default is clearColor) 51 | 52 | ## Treat yourself to these other libraries of mine 53 | 54 | An elegant solution for keeping any UIView visible when the keyboard is being shown https://github.com/IdleHandsApps/IHKeyboardAvoiding 55 | 56 | Tap to dismiss the keyboard with IHKeyboardDismissing https://github.com/IdleHandsApps/IHKeyboardDismissing 57 | 58 | ## Author 59 | 60 | * Fraser Scott-Morrison (fraserscottmorrison@me.com) 61 | 62 | It'd be great to hear about any cool apps that are using IHParallaxNavigationController 63 | 64 | ## License 65 | 66 | Distributed under the MIT License 67 | --------------------------------------------------------------------------------