显示UI元素与动画在iPhone [英] Showing UI Element with Animation on iPhone

查看:113
本文介绍了显示UI元素与动画在iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法做到以下几点没有瞬间隐藏/取消隐藏?还是我做的一切独立的视图或复杂的东西?淡出像模式转变作风简单的褪色是我要找的。

   - (IBAction为)的someMethod
{
    UIButton.hidden = NO;
    tableView.hidden = NO;
} - (无效)viewDidLoad中
{
    UIbutton.hidden = YES;
    tableView.hidden = YES;
}


解决方案

您可以动画alpha值:

  [UIView的animateWithDuration:0.5F动画:^ {
    button.alpha = 0.0;
    tableView.alpha = 0.0;
}];

和它的对手

  [UIView的animateWithDuration:0.5F动画:^ {
    button.alpha = 1.0F;
    tableView.alpha = 1.0F;
}];

Is there a way to do the following without an instant hide/unhide? Or do I have to make everything a separate view or something complicated? A simple fade in fade out like the modal transition style is all I'm looking for.

-(IBAction)someMethod
{
    UIButton.hidden = NO;
    tableView.hidden = NO;
}

-(void)viewDidLoad
{
    UIbutton.hidden = YES;
    tableView.hidden = YES;
}

解决方案

You could animate the alpha value:

[UIView animateWithDuration:0.5f animations:^{
    button.alpha = 0.0f;
    tableView.alpha = 0.0f;
}];

and it's counterpart

[UIView animateWithDuration:0.5f animations:^{
    button.alpha = 1.0f;
    tableView.alpha = 1.0f;
}];

这篇关于显示UI元素与动画在iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆