用动画隐藏和显示按钮,iphone

时间:2012-07-20 19:10:26

标签: iphone animation uibutton

隐藏或显示我正在使用的视图中的按钮

myButton.hide = YES or myButton.hide = NO

我正在寻找一种动画显示按钮的方式,例如慢慢淡入

有人知道怎么做,请帮忙

由于

1 个答案:

答案 0 :(得分:4)

您可以使用UIView动画。 这是一个简单的实现:

// to hide
[UIView animateWithDuration:0.5
    delay:1.0
    options: UIViewAnimationCurveEaseOut
    animations:^{
        myButton.alpha = 0.0
    } 
    completion:^(BOOL finished){
        NSLog(@"Done!");
    }];

// to show (implement in another method)
[UIView animateWithDuration:0.5
    delay:1.0
    options: UIViewAnimationCurveEaseOut
    animations:^{
        myButton.alpha = 1.0;
    } 
    completion:^(BOOL finished){
        NSLog(@"Done!");
    }];

以下是一个很好的教程:How To Use UIView Animation Tutorial

您可能也想查看文档:{​​{3}}

本网站也有类似的质量保证: UIView Class Reference

希望它有所帮助!

相关问题