TLMotionEffect 重力感应
https://github.com/jvenegas/TLMotionEffect
This category adds a motion effect to your UIView. This is a similar effect can be seen in the background of the Home Screen on iOS 7.
Feel Free to complete this category with more motion effects. :)
The library has been tested on iOS 7.0+ for ARC environments.
这个category给你的UIView添加了重力感应效果。与你iOS7系统界面的背景图片移动效果类似哦。
欢迎你来完善这个category来实现更多的效果。
这个library已经在iOS7+上测试过,开了ARC哦。
Set up your Xcode project
-
Add into your project the following classes: 把以下两个文件添加到你的工程当中
UIView+TLMotionEffect.h
UIView+TLMotionEffect.m
-
Import the category and call the following method 引入这个category,并调用如下方法
#import "UIView+TLMotionEffect.h"
- (void)addCenterMotionEffectsXYWithOffset:(CGFloat)offset;
- Example 例子
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 100.0f)];
[myView addCenterMotionEffectsXYWithOffset:40];
You can run the tests in Xcode. Open TLMotion/TLMotionEffect.xcodeproj
.
你可以在你的Xcode中进行测试。
- Javier Venegas https://github.com/jvenegas