点击视图区域,实现图片image的动画效果:左右摇摆 大家好:我现在要实现一个动画效果:具体:点击image的区域,image左右摇摆。起初我自己以为是UIButton,上的前面图片,因为在上层图片左右摇摆的过程中,背景图片是不发生变化的。后来我看了UIButton的手册,在其自身的属性以及方法列中发现,根本没有动态变化的相关设置。现在真的很盲目,不知该朝着什么样的方向来完成。还请各位给点意见,不胜感激! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 UIImageView *backView=[[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; self.view=[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; [self.view addSubview:backView]; backView.image=newImage; backView.alpha=0.3; CABasicAnimation *theAnimation1; //定义动画 //左右摇摆 theAnimation1=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; theAnimation1.fromValue=[NSNumber numberWithFloat:0]; theAnimation1.toValue=[NSNumber numberWithFloat:-100]; theAnimation1.duration=5.5;//动画持续时间 theAnimation1.repeatCount=6;//动画重复次数 theAnimation1.autoreverses=YES;//是否自动重复 [backView.layer addAnimation:theAnimation1 forKey:@"animateLayer"]; [newImage release]; Thank you:Rey谢谢你的帮助,是我没有说清除。要是以图片的底边的中心点为一个轴心,这样摆动,英爱怎么实现呢。倘若事左右摇摆45。c, 望指点。谢谢 你弄几张差几帧的图片,弄一个UIImageView的动画就行了 UIView 旋转你要用到layer。 iphone中的圆形相框效果 新手入门,如何声明一个数组??? 请问在xcode中删除一行的快捷键是什么 ipod touch 越狱真机调试 iphone iad 怎么进行测试呀? 咨询个objective-c的语法问题 IOS 开发 手机建立服务器,浏览器登录查看Uiview 高富帅新标准,一段屌丝逆袭的独白! 新手问题关于调用成员变量的 sqlite3从后往前查询数据,每次查询20条 iOS开发未来趋势是怎样,请各位大虾指点下!!! 请问怎么在ios程序中调用vnc viewer连接PC
self.view=[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[self.view addSubview:backView];
backView.image=newImage;
backView.alpha=0.3;
CABasicAnimation *theAnimation1; //定义动画
//左右摇摆
theAnimation1=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
theAnimation1.fromValue=[NSNumber numberWithFloat:0];
theAnimation1.toValue=[NSNumber numberWithFloat:-100];
theAnimation1.duration=5.5;//动画持续时间
theAnimation1.repeatCount=6;//动画重复次数
theAnimation1.autoreverses=YES;//是否自动重复
[backView.layer addAnimation:theAnimation1 forKey:@"animateLayer"];
[newImage release];