CGAffineTransform and scaling to center of the image

后端 未结 3 920
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-12 02:16

I started studying objective-c using the iPhone and iPad apps for Absolute Beginners by Rory Lewis book but i got stuck on the 5th chapter.

I want to make a

3条回答
  •  不要未来只要你来
    2021-01-12 02:36

    Try something like this:

    CGAffineTransform t = CGAffineTransformMakeScale(0.5, 0.5);
    CGPoint center = imageView.center; // or any point you want
    [UIView animateWithDuration:0.5
                     animations:^{
                        imageView.transform = t;
                        imageView.center = center;
                     }
                     completion:^(BOOL finished) {
                        /* do something next */
                     }];
    

    Next time show your code. It will be easier to help you.

    Check this project: https://github.com/djromero/StackOverflow/archive/Q-13706255.zip

    You must study how autolayout and autoresize affect your views. In the project above both are disabled to let you see how it works.

提交回复
热议问题