如何在动画期间剪辑 UILabel?
我正在自定义按钮上设置 UILabel 动画。我希望它看起来好像 UILabel 从右侧“滚动到”按钮上。
我的计划是将标签定位在按钮右侧 50 像素处,开始动画,将其移动到正确的位置,然后提交动画。然而,在整个动画中,我想将标签剪辑到按钮的框架上,这样您只能看到与按钮重叠的标签部分,而没有任何内容悬挂在右侧。
最好的方法是什么?
谢谢。
I am animating a UILabel over a custom button. I want it to appear as though the UILabel is "rolling onto" the button from the right.
My plan is to position the label 50 pixels to the right of the button, begin animation, move it to its correct position, and commit animation. However, throughout the animation I want to clip the label to the frame of the button, so that you only see the piece of the label that overlaps the button and nothing hanging over to the right.
What's the best way to do this?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够在制作动画之前将标签添加为按钮的子视图。然后将按钮的 ClipsToBounds 属性设置为 YES。
You should be able to add the label as a subview of your button before animating. Then set your the clipsToBounds property of your button to YES.