在transitionFromView期间缩放UIView?
我使用容器 UIView 来复制 iTunes 商店在您点击专辑插图时的行为,它会翻转和缩放。
当前代码如下所示:
//mainView is 300x300x, smallView is 30x30
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView transitionFromView:mainView toView:smallView duration:3.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];
containerView.frame = CGRectMake(275, 415, 30, 30);
[UIView commitAnimations];
我似乎无法在动画过程中缩放 containerView 的内容,框架只是靠近内容。我尝试对视图和图层以及其他一些东西应用一些转换,但我似乎无法让它正常运行。
I'm using a container UIView to replicate the kind of behavior the iTunes store does when you tap on album artwork and it flips and scales.
Current code looks like:
//mainView is 300x300x, smallView is 30x30
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView transitionFromView:mainView toView:smallView duration:3.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];
containerView.frame = CGRectMake(275, 415, 30, 30);
[UIView commitAnimations];
I can't seem to get the content of the containerView to scale during the animation, the frame just closes in on the content. I tried applying some transforms to both the view and the layers and a bunch of other things but I can't seem to get it to behave properly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不要设置框架,而是尝试使用变换:
类似的东西
(您可能也需要对变换应用翻译。)
Rather than setting the frame, try using a transform instead:
Something like
(You might need to apply a translate to the transform too.)
试试这样:
Try it this way: