动画子视图的大小
假设我有一个标准的 UIView 来显示我的屏幕。其中是另一个 UIView,它本身包含三个按钮:
--------------------------
| |
| |
| |
| ------------------- |
| | 1 | 2 | 3 | | UIView A
| | | | | | contains UIView B
| ------------------- | which contains 3 buttons.
| |
| |
| |
--------------------------
我希望能够通过将按钮块在中心变小,然后“爆炸”变大,将这些按钮动画显示到屏幕上。我知道我可以单独为每个按钮设置动画,但是如何仅使用 UIView B 来做到这一点。有没有一种方法可以让按钮在动画时根据 UIView B 的大小自动调整大小?
Let's say I have a standard UIView to show my screen. Within that is another UIView, which itself contains three buttons:
--------------------------
| |
| |
| |
| ------------------- |
| | 1 | 2 | 3 | | UIView A
| | | | | | contains UIView B
| ------------------- | which contains 3 buttons.
| |
| |
| |
--------------------------
I'd like to be able to animate these buttons onto the screen, by starting the button block small in the center, and then 'exploding' bigger. I know I could animate each button individually, but how could I do it just using UIView B. Is there a way that the buttons could automatically resize according to the size of UIView B when animating?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试在这三个按钮上设置
autoresizingMask
属性,使其具有灵活的边距、高度和宽度,以便当您更改 UIView B 的大小时,它们会随着 UIView B 一起“增长”You can try to set the
autoresizingMask
attribute on the three buttons, to have flexible margins, height and width, so that they "grow" with UIView B as you change the size of UIView B