V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
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 · Apr 26, 2014 · 4043 views
    This topic created in 4384 days ago, the information mentioned may be changed or developed.
    从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
    Supplement 1  ·  Apr 27, 2014
    结贴了:

    Disable auto layout:

    self.imageView.translatesAutoresizingMaskIntoConstraints = YES;
    8 replies    2014-05-24 19:09:09 +08:00
    alexrezit
        1
    alexrezit  
       Apr 26, 2014
    把 auto layout 關了試試?
    parkman
        2
    parkman  
    OP
       Apr 26, 2014
    @alexrezit 关了确实可以。 可是我想使用auto layout怎么应该怎么设置。
    alexrezit
        3
    alexrezit  
       Apr 26, 2014
    @parkman
    RTFD.
    parkman
        4
    parkman  
    OP
       Apr 26, 2014
    @alexrezit 什么是 RTFD
    alexrezit
        5
    alexrezit  
       Apr 26, 2014
    @parkman
    UTFG.
    parkman
        6
    parkman  
    OP
       Apr 26, 2014
    parkman
        7
    parkman  
    OP
       Apr 26, 2014
    google?
    engHacker
        8
    engHacker  
       May 24, 2014
    @parkman 需要教程联系1660141669
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3468 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 10:53 · PVG 18:53 · LAX 03:53 · JFK 06:53
    ♥ Do have faith in what you're doing.