Latest 1.1.0
Homepage https://github.com/Morgan-Kennedy/MKParallaxView
License MIT Created by Morgan Kennedy on 19/07/13.

This code is distributed under the terms and conditions of the MIT license.

Copyright (c) 2013 Morgan Kennedy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Platforms ios 5.0, requires ARC
Frameworks CoreMotion
Authors

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];

Latest podspec

{
    "name": "MKParallaxView",
    "version": "1.1.0",
    "summary": "MKParallaxView is an easy to use framework used to create the IOS 7 Parallax Effect (Dynamic Background) on any of your apps!",
    "description": "                   ttMKParallaxView is an easy to use framework used to create the IOS 7 Parallax Effect (Dynamic Background) on any of your apps!nnttttttTreat 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.n",
    "homepage": "https://github.com/Morgan-Kennedy/MKParallaxView",
    "license": {
        "type": "MIT",
        "text": "  ttttttCreated by Morgan Kennedy on 19/07/13.nn  ttttttThis code is distributed under the terms and conditions of the MIT license.nn  ttttttCopyright (c) 2013 Morgan Kennedynn  ttttttPermission is hereby granted, free of charge, to any person obtaining a copyn  ttttttof this software and associated documentation files (the "Software"), to dealn  ttttttin the Software without restriction, including without limitation the rightsn  ttttttto use, copy, modify, merge, publish, distribute, sublicense, and/or selln  ttttttcopies of the Software, and to permit persons to whom the Software isn  ttttttfurnished to do so, subject to the following conditions:nn  ttttttThe above copyright notice and this permission notice shall be included inn  ttttttall copies or substantial portions of the Software.nn  ttttttTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORn  ttttttIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,n  ttttttFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEn  ttttttAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERn  ttttttLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,n  ttttttOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INn  ttttttTHE SOFTWARE.nn"
    },
    "authors": {
        "Morgan Kennedy": "[email protected]"
    },
    "platforms": {
        "ios": "5.0"
    },
    "source": {
        "git": "https://github.com/Morgan-Kennedy/MKParallaxView.git",
        "tag": "1.1.0"
    },
    "source_files": "MKParallaxView/**/*.{h,m}",
    "frameworks": "CoreMotion",
    "requires_arc": true
}

Pin It on Pinterest

Share This