V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
parkman
V2EX  ›  iDev

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

  •  
  •   parkman · 2014-04-26 16:36:43 +08:00 · 3342 次点击
    这是一个创建于 3657 天前的主题,其中的信息可能已经有所发展或是发生改变。
    从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
    第 1 条附言  ·  2014-04-27 09:18:59 +08:00
    结贴了:

    Disable auto layout:

    self.imageView.translatesAutoresizingMaskIntoConstraints = YES;
    8 条回复    2014-05-24 19:09:09 +08:00
    alexrezit
        1
    alexrezit  
       2014-04-26 17:18:35 +08:00
    把 auto layout 關了試試?
    parkman
        2
    parkman  
    OP
       2014-04-26 19:38:08 +08:00
    @alexrezit 关了确实可以。 可是我想使用auto layout怎么应该怎么设置。
    alexrezit
        3
    alexrezit  
       2014-04-26 20:06:01 +08:00
    @parkman
    RTFD.
    parkman
        4
    parkman  
    OP
       2014-04-26 20:21:16 +08:00
    @alexrezit 什么是 RTFD
    alexrezit
        5
    alexrezit  
       2014-04-26 20:25:21 +08:00
    @parkman
    UTFG.
    parkman
        6
    parkman  
    OP
       2014-04-26 20:28:33 +08:00
    parkman
        7
    parkman  
    OP
       2014-04-26 20:29:07 +08:00
    google?
    engHacker
        8
    engHacker  
       2014-05-24 19:09:09 +08:00
    @parkman 需要教程联系1660141669
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2633 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 13:39 · PVG 21:39 · LAX 06:39 · JFK 09:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.