实现类似iphone手机删除应用程序的抖动效果
2012-06-15 10:16
489 查看
其实原理很简单,让图片向左,再向右旋转一定角度就可以啦
static BOOL wobblesLeft = NO;
UIButton * button=[UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[UIImage imageNamed:@"宝宝日记_1.png"] forState:UIControlStateNormal];
button.frame=CGRectMake(10, 10, 40, 40);
CGFloat rotation=(3*M_PI)/180;
CGAffineTransform wobbleLeft=CGAffineTransformMakeRotation(rotation);
CGAffineTransform wobbleRight=CGAffineTransformMakeRotation(-rotation);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.2];
[UIView setAnimationDelegate:self];
[UIView setAnimationRepeatCount:999999999];
button.transform = wobblesLeft ? wobbleRight : wobbleLeft;
wobblesLeft = !wobblesLeft;
[UIView commitAnimations];
[self.view addSubview:button];
static BOOL wobblesLeft = NO;
UIButton * button=[UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[UIImage imageNamed:@"宝宝日记_1.png"] forState:UIControlStateNormal];
button.frame=CGRectMake(10, 10, 40, 40);
CGFloat rotation=(3*M_PI)/180;
CGAffineTransform wobbleLeft=CGAffineTransformMakeRotation(rotation);
CGAffineTransform wobbleRight=CGAffineTransformMakeRotation(-rotation);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.2];
[UIView setAnimationDelegate:self];
[UIView setAnimationRepeatCount:999999999];
button.transform = wobblesLeft ? wobbleRight : wobbleLeft;
wobblesLeft = !wobblesLeft;
[UIView commitAnimations];
[self.view addSubview:button];
相关文章推荐
- 使用UICollectionView实现应用程序管理(删除图标 抖动效果)
- IOS 实现类似桌面删除应用程序的效果(长按 可编辑 删除 图片按比例截取)
- 原生js实现类似弹窗抖动效果
- 将一个view 的背景设为透明 但view上的图标 不透明 实现类似iphone ipad 主页的滑动效果
- javascript 仿iphone手机输入密码错误时抖动效果
- CAGradientLayer(颜色渐变) -- 实现iphone手机屏幕“滑动来解锁”动画效果
- android自定义控件SlidingButtonView实现类似QQ滑动删除效果
- 不用图片,纯Css3实现超酷的类似iphone的玻璃气泡效果
- 【axure手机原型】Axure实现iPhone推动切换效果
- iphone 图表抖动效果实现-左上角小黑叉实习(层的使用)
- JavaScript实现的类似腾讯QQ聊天窗口抖动效果
- iphone:实现像DrawSomething类似的自动画图的动画效果
- Android实现类似QQ的滑动删除效果
- 【axure手机原型】Axure实现iPhone推动切换效果
- 使用luncher实现类似iphone平滑滑动效果
- Android 类似IPhone图片点击效果实现,点击logo变暗
- Mac - 实现删除按钮的抖动效果
- iphone手机桌面滑动效果使用css3实现
- Android实战简易教程-第十四枪(介绍SwipeMenuListView-简单实现类似QQ的滑动删除效果)
- 不用图片,纯Css3实现超酷的类似iphone的玻璃气泡效果