开发者社区 问答 正文

关于IOS-隐藏uibutton的动画

应用中想要给UIButton加一个动画。让按钮能淡出屏幕然后隐藏。

我写的代码,没实现:

[UIView animateWithDuration:1.5
                 animations:^{
                    S1Button.frame = CGRectMake(20, 10, 50, 10);
                }];
[S1Button setHidden:YES];
break;

展开
收起
爵霸 2016-03-19 09:56:11 2433 分享
分享
版权
举报
1 条回答
写回答
取消 提交回答
  • 可以在动画结束后给按钮设置新坐标:

     [UIView animateWithDuration:0.9 animations:^{
            tradeButton.frame = (CGRect){ CGPointMake(51, 150), tradeButton.bounds.size };
        } completion:^(BOOL finished) {
            tradeButton.hidden = YES;
            // etc.
        }];
    2019-07-17 19:07:23 举报
    赞同 评论

    评论

    全部评论 (0)

    登录后可评论
问答标签:
问答地址:
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等