求助 Animation, 为何 Zoom Out 不是在中心点缩小,anchorPoint 又没有重置。

2014-04-26 16:36:43 +08:00
 parkman
从raywenderlich 找了一份源码思路是:

- (void) addSubviewWithZoomInAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option
{
// first reduce the view to 1/100th of its original dimension
CGAffineTransform trans = CGAffineTransformScale(view.transform, 0.01, 0.01);
view.transform = trans; // do it instantly, no animation
[self addSubview:view];
// now return the view to normal dimension, animating this tranformation
[UIView animateWithDuration:secs delay:0.0 options:option
animations:^{
view.transform = CGAffineTransformScale(view.transform, 100.0, 100.0);
}
completion:nil];
}

- (void) removeWithZoomOutAnimation:(float)secs option:(UIViewAnimationOptions)option
{
[UIView animateWithDuration:secs delay:0.0 options:option
animations:^{
self.transform = CGAffineTransformScale(self.transform, 0.01, 0.01);
}
completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}

我借鉴了下,Zoom in 倒是没有问题。 为何Zoom out 不是在中心点缩小了


源码地址在这边,有兴趣的帮我看一看谢谢了。
http://pan.baidu.com/s/1jG2vWLS
3350 次点击
所在节点    iDev
8 条回复
alexrezit
2014-04-26 17:18:35 +08:00
把 auto layout 關了試試?
parkman
2014-04-26 19:38:08 +08:00
@alexrezit 关了确实可以。 可是我想使用auto layout怎么应该怎么设置。
alexrezit
2014-04-26 20:06:01 +08:00
@parkman
RTFD.
parkman
2014-04-26 20:21:16 +08:00
@alexrezit 什么是 RTFD
alexrezit
2014-04-26 20:25:21 +08:00
@parkman
UTFG.
parkman
2014-04-26 20:28:33 +08:00
parkman
2014-04-26 20:29:07 +08:00
google?
engHacker
2014-05-24 19:09:09 +08:00
@parkman 需要教程联系1660141669

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/110140

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX