开发者

Animation to shrink view to top left corner

开发者 https://www.devze.com 2023-01-04 16:06 出处:网络
I would like to shrink my UIView to the top left corner. I am currently using a scale transform to achieve this,开发者_运维技巧 but the view is shrunk to the center. I have tried to change the layer\'

I would like to shrink my UIView to the top left corner. I am currently using a scale transform to achieve this,开发者_运维技巧 but the view is shrunk to the center. I have tried to change the layer's anchorpoint, but this results in the entire view changing position on screen . How should a transform be set up to achieve a shrink to the top left corner? Thank you


Something like:

[UIView beginAnimations:nil context:nil];
// setAnimationDuration
// set transform scaling
myView.center = CGPointMake (0, 0);
[UIView commitAnimations];

If you are transforming it to something like 50% of the screen you can change the center point to where it should be. For example, if it's a 320x480 view, you'll be scaling it to 160x240...so the center point will need to be 160/2 (80) and 240/2 (120)...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号