iPerspective is a iOS librarie of control with augmented reality.
- UIImageViewPerspective: UIImageView with perspective when user move device.
- UIImageView+Perspective: Category for UIImageView and permit to create UIImageView with perspective when user move device.
- UIViewPerspective: UIView with perspective when user move device. (Under construction)
- UIView+Perspective: Category for UIView and permit to create UIView with perspective when user move device. (Under construction)
Documentation: iPerspectiveDocs
N/A
iPerspective is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'iPerspective'
And execute this command in your project folder:
pod install
See the sample project iPerspective in 'Exemple' directory.
All control in iPerspective use 'CoreMotion'. It's prefered to create a single instance of CMMotionManager for all control in your app.
#import <CoreMotion/CoreMotion.h>
...
@interface EPViewController2 ()
{
CMMotionManager *motionmanager;
}
...
- (CMMotionManager *)sharedManager
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
motionmanager = [[CMMotionManager alloc] init];
});
return motionmanager;
}
UIImageViewPerspective is a subclass of UIImageView. You can use that to replace your UIImageView.
Import :
#import <iPerspective/UIImageViewPerspective.h>
Setup UIImageViewPerspective:
// initialize _imagePerspective
[_imagePerspective setMotionManger:[self sharedManager]]; // (Mandatory) set motion manager
[_imagePerspective setMaximumAmplitude:20.0]; // (Optional) maximum move of UIImageView
[_imagePerspective setMaximumAngle:2.0]; // (OPtional) maximum angle managed
[_imagePerspective setUpdateInterval:0.01]; // (Optional) interval of refresh
Start image motion with core motion:
// start image motion with core motion
[_imagePerspective startUpdate];
Stop image motion:
// stop image motion
[_imagePerspective stopUpdate];
See the sample project iPerspective in 'Exemple' directory.
UIImageView+Perspective is a category. You can use that to replace your UIImageView.
Import :
#import <iPerspective/UIImageView+Perspective.h>
Start image motion with core motion:
// start image motion with core motion
[_imagePerspective startUpdate:0.01 manager:[self sharedManager]];
Stop image motion:
// stop image motion
[_imagePerspective stopUpdate:[self sharedManager]];
Eric Pinet, pineri01@gmail.com
iPerspective is available under the MIT license. See the LICENSE file for more info.