Skip to content

IHParallaxNavigationController is a UINavigationController subclass that uses a parallax effect when pushing and popping view controllers

License

Notifications You must be signed in to change notification settings

IdleHandsApps/IHParallaxNavigationController

Repository files navigation

alt icon IHParallaxNavigationController

A drop in UINavigationController subclass that uses a parallax effect when pushing and popping view controllers

alt demo

Description

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.

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

IHParallaxNavigationController is a sublass of UINavigationController so all standard animations, transitions and gestures are supported.

How to install

Add this to your CocoaPods Podfile.

pod 'IHParallaxNavigationController'

How to use

Using storyboards:

Change your UINavigationController to a IHParallaxNavigationController Then change your UIViewControllers to IHParallaxViewControllers Then just call setParallaxImage:(UIImage *)image to set the background parallax view

Without storyboards:

Initialise the navigation controller

IHParallaxNavigationController *parallaxNavController = [[IHParallaxNavigationController alloc] initWithRootViewController:rootController];
[parallaxNavController setParallaxImage:[UIImage imageNamed:@"my_img"]];

When you add a view controller to the navigation stack, ensure its a subclass of IHParallaxViewController

IHParallaxViewController *parallaxController = [[IHParallaxViewController alloc] init];
[parallaxNavController pushViewController:parallaxController animated:YES];

Optional methods

Set totalParallaxLevels to the maximum number of UIParallaxViewControllers in your navigation stack, to ensure your background parallax view is scaled correctly (default is 2)

Set parallaxSpan to to change the displacement of each transition (default is 30). Setting parallaxSpan=0 will disable the parallax effect

Set customNavBar color to: nil=grey, clearColor=transparent, or any UIColor of you choice (default is clearColor)

Treat yourself to these other libraries of mine

An elegant solution for keeping any UIView visible when the keyboard is being shown https://github.com/IdleHandsApps/IHKeyboardAvoiding

Tap to dismiss the keyboard with IHKeyboardDismissing https://github.com/IdleHandsApps/IHKeyboardDismissing

Author

It'd be great to hear about any cool apps that are using IHParallaxNavigationController

License

Distributed under the MIT License

About

IHParallaxNavigationController is a UINavigationController subclass that uses a parallax effect when pushing and popping view controllers

Resources

License

Stars

Watchers

Forks

Packages

No packages published