我试图弄清楚如何将我的 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.
}
}];