Iphone uitabbaritem的α值

Iphone uitabbaritem的α值,iphone,ios,uiimageview,uiimage,alpha,Iphone,Ios,Uiimageview,Uiimage,Alpha,我正在试图找出如何将我的tabbaritem图标(图像)设置为0,以便在它加载到屏幕上后,我可以给它一个淡入淡出的动画。。。但我就是不知道怎么做 这就是我将图像添加到选项卡栏的方式 - (void)viewDidAppear:(BOOL)animated { self.button0.image = [UIImage imageNamed:@"icon1.png"]; self.button1.image = [UIImage imageNamed:@"icon2.png"];

我正在试图找出如何将我的tabbaritem图标(图像)设置为0,以便在它加载到屏幕上后,我可以给它一个淡入淡出的动画。。。但我就是不知道怎么做

这就是我将图像添加到选项卡栏的方式

- (void)viewDidAppear:(BOOL)animated
{

    self.button0.image = [UIImage imageNamed:@"icon1.png"];
    self.button1.image = [UIImage imageNamed:@"icon2.png"];
    self.button2.image = [UIImage imageNamed:@"icon3.png"];
    self.button3.image = [UIImage imageNamed:@"icon4.png"];
    self.button4.image = [UIImage imageNamed:@"icon5.png"];
    self.button5.image = [UIImage imageNamed:@"icon1.png"];


}
我将用一种类似这样的方法来设置它们的动画

[UIView animateWithDuration:0.3f
                              delay:0.0f
                            options:UIViewAnimationOptionCurveEaseOut
                         animations:^{
                             // Do your animations here
                         }
                         completion:^(BOOL finished){
                             if (finished) {
                                 // Do your method here after your animation.

                             }
                         }];
任何帮助都将不胜感激

更新这是我的最新尝试,但尚未成功

buttonImage0.image = [UIImage imageNamed:@"icon1.png"];
    buttonImage0.alpha = 0.0;
    self.button0.image = buttonImage0.image;


    [UIView animateWithDuration:0.1f
                          delay:0.0f
                        options:UIViewAnimationOptionTransitionNone
                     animations:^{
                         // Do your animations here.
                         buttonImage0.alpha = 1.0;
                     }
                     completion:^(BOOL finished){
                         if (finished) {
                             // Do your method here after your animation.
                         }
                     }];

UIButton是UIView的一个子类。UIView具有alpha属性

尝试:

在你的视野中出现


然后使用相同的alpha属性将缓和函数放入animateWithDuration例程中

我不确定你是否能设定阿尔法。假设这是可能的,您可以在动画代码块内将alpha设置为0。我需要在代码块之前将其设置,然后在动画中将alpha设置为1(像图像淡入淡出一样),我想我已经解决了,我将创建imageview首先设置alpha,然后将该图像传递到tabbaritem,然后在代码plock中,我将使图像淡入。完成后,我将发布代码,你们可以告诉我它有多糟糕:)啊,很抱歉,这是我不好的命名约定,它是tabbaritem,因此,当我尝试您的解决方案时,在类型为“uitabaritem*”的对象上找不到属性“alpha”,请尝试在UITabBar上使用alpha属性,而不是单独使用每个项。uitabaritem不从UIView继承,因此它没有alpha属性,但UITabBar确实从UIView继承。
self.button0.alpha = 0.0;
self.button1.alpha = 0.0;
self.button2.alpha = 0.0;
self.button3.alpha = 0.0;
self.button4.alpha = 0.0;
self.button5.alpha = 0.0;