CABasicAnimation *contentMove = [CABasicAnimation animationWithKeyPath:@"contentsRect.origin.y"];
contentMove.fromValue = [NSNumber numberWithFloat:1.0f];
contentMove.toValue = [NSNumber numberWithFloat:1.0f];
contentMove.duration = 2;
CAAnimationGroup *group = [CAAnimationGroup animation];
group.delegate = self;
[group setDuration:2];
[group setFillMode:kCAFillModeForwards];
group.removedOnCompletion =NO;
[group setAnimations: [NSArray arrayWithObjects:contentMove,nil]];
[group setBeginTime:CACurrentMediaTime()];
[self.imageV.layer addAnimation:group forKey:@"WW"];
应该看不到对象才对啊
contentMove.fromValue = [NSNumber numberWithFloat:1.0f];
contentMove.toValue = [NSNumber numberWithFloat:1.0f];
contentMove.duration = 2;
CAAnimationGroup *group = [CAAnimationGroup animation];
group.delegate = self;
[group setDuration:2];
[group setFillMode:kCAFillModeForwards];
group.removedOnCompletion =NO;
[group setAnimations: [NSArray arrayWithObjects:contentMove,nil]];
[group setBeginTime:CACurrentMediaTime()];
[self.imageV.layer addAnimation:group forKey:@"WW"];
应该看不到对象才对啊
解决方案 »
- 【提问】UISearchBar的页面跳转问题
- 【布衣分享】手机瀑布流的实现
- 谁有广播式的push源码,最好是C#版的,我手头上只有个单机推送的JdSoft.Apple.Apns.Notifications源码
- iphone 绘制拓扑图。十万火急!!!!!!!!!!!!!
- iOS三种Json方法解析国家气象局API
- iphone 开发,如何隐藏navigationbar????请指教。。。
- IOS UITextFielder的placeholder 如何清除
- 如何用代码获取ios设备所能探测到得wifi热点信号的强度(越狱,非越狱都行)
- iOS 怎么改变webview内部一个链接的头部信息??
- 手动改别人的app
- 新手想做苹果APP开发,到底学哪一门语言更好?
- 请问关于self,我的理解有错误吗?
contentMove.fromValue = [NSNumber numberWithFloat:1.0f];
contentMove.toValue = [NSNumber numberWithFloat:1.0f];
fromValue 与toValue 值一样,即使动画生效你也看不到变化。
contentMove.toValue = [NSNumber numberWithFloat:0.0f];从上到下出现,但是有一个拉伸
你这个动画只是一个位置的移动动画,你不能只设置y轴坐标,需要通过点来移动。见下面代码
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
// 动画选项的设定
animation.duration = 2.5; // 持续时间
animation.repeatCount = 1; // 重复次数
// 起始帧和终了帧的设定
animation.fromValue = [NSValue valueWithCGPoint:myView.layer.position]; // 起始帧
animation.toValue = [NSValue valueWithCGPoint:CGPointMake(320, 480)]; // 终了帧
// 添加动画
[myView.layer addAnimation:animation forKey:@"move-layer"];