mkp

MKParallaxView

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.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

51

Maintenance

Last Commit

7yrs ago

Contributors

3

Package

Dependencies

0

License

MIT

Categories

Readme

MKParallaxView

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.

UPDATES:

  • Storyboard Friendly (Thanks Kinwo)
  • Overridden Getters for parameters (Thanks Augard)

MKParallaxView is now a CocoaPod! so jump to http://cocoapods.org/ 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:

MKGyroManager

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
MKGyroManagerUpdateAnglesNotification

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100