iPerspective 0.2.1

iPerspective 0.2.1

测试已测试
Lang语言 Obj-CObjective C
许可协议 MIT
发布最后发布2015年1月

Eric Pinet维护。



  • 作者
  • Eric Pinet

iPerspective是一个增强现实控制的iOS库。

  • UIImageViewPerspective:用户移动设备时具有透视效果的UIImageView。
  • UIImageView+Perspective:为UIImageView创建一系列类别,允许用户在移动设备时创建具有透视效果的UIImageView。
  • UIViewPerspective:用户移动设备时具有透视效果的UIView。(建设中)
  • UIView+Perspective:为UIView创建一系列类别,允许用户在移动设备时创建具有透视效果的UIView。(建设中)

文档:iPerspectiveDocs

iPerspective

iPerspective

要求

N/A

安装

iPerspective可通过CocoaPods访问。要安装,只需将以下行添加到您的Podfile中:

pod 'iPerspective'

并在项目文件夹中执行此命令

pod install

'UIImageViewPerspective'的用法。

查看'Exemple'目录中的示例项目iPerspective。

准备'CMMotionManager'

iPerspective中所有控件都使用'CoreMotion'。建议为您的应用中的所有控件创建单个CMMotionManager实例。

#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。

UIImageViewPerspective是UIImageView的子类。您可以用它来替换您的UIImageView。

导入

#import <iPerspective/UIImageViewPerspective.h>

设置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

启动通过CoreMotion的图像运动

// start image motion with core motion
[_imagePerspective startUpdate];

停止图像运动

// stop image motion
[_imagePerspective stopUpdate];

'UIImageView+Perspective'的用法。

查看'Exemple'目录中的示例项目iPerspective。

在您的应用中使用UIImageView+Perspective。

UIImageView+Perspective是一个类别。您可以用它来替换您的UIImageView。

导入

#import <iPerspective/UIImageView+Perspective.h>

启动通过CoreMotion的图像运动

// start image motion with core motion
[_imagePerspective startUpdate:0.01 manager:[self sharedManager]];

停止图像运动

// stop image motion
[_imagePerspective stopUpdate:[self sharedManager]];

作者

Eric Pinet,[email protected]

许可协议

iPerspective可在MIT许可下使用。有关更多信息,请参阅LICENSE文件。