MKParallaxView 1.1.0

MKParallaxView 1.1.0

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.

  • By
  • Morgan Kennedy

MKParallaxView is an easy to use framework used to create the IOS 7 Parallax Effect (Dynamic Background) on any of your apps!

Treat it just like a UIImageView and by simply assigning an image to it with 1 line you have the exact same effect for the background of your app.

MKParallaxView is now a CocoaPod! so jump to to get it that way :)

Important note: this framework uses the device's gyro, so it will look just like a normal background in simulators. Try the demo on a device instead!

To start go to Project -> Target -> Build Phases -> Link Binary With Libraries and add CoreMotion.framework

In the view or view controller (or prefix):

#import "MKParallaxView.h"

To create the parallax view with a basic background image do the following:

MKParallaxView *basicBackground = [[MKParallaxView alloc] initWithFrame:self.frame]; basicBackground.backgroundImage = [UIImage imageNamed:@"backgroundImage.png"];

To create the parallax view with a repeat background image do the following:

MKParallaxView *repeatBackgound = [[MKParallaxView alloc] initWithFrame:self.frame]; repeatBackgound.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backgroundRepeatableImage.png"]];

The animation defaults at 60 frames per second (fps) which is really smooth, but if you want to bring it down to say 30 fps, just do the following on each MKParallaxView you have:

basicBackground.updateRate = 30;

I hope you enjoy this framework. Please star it above; and if your iTunes app uses it, please add it to the list on the wiki along with an iTunes link.

Thank you,

Kind Regards

Morgan Kennedy

p.s. If you want you can utilize the MKGyroManager as is:


If you want to use the "roll" "pitch" "yaw" values that the gyro manager (singleton) spits out 60 times a second anywhere else in your app you can by doing the following:

#import "MKGyroManager.h"
@interface MyViewController ()< MKGyroManagerDelegate >
[MKGyroManager sharedGyroManager].delegate = self;
- (void)MKGyroManagerUpdatedRoll:(CGFloat)roll Pitch:(CGFloat)pitch Yaw:(CGFloat)yaw

There's also a NSNotification that you can listen to if you prefer with the values in the notification.userInfo

Or you can just observe the latestValue of a specific attribute like so:
CGFloat roll = [[MKGyroManager sharedGyroManager] roll];