【发布时间】:2013-05-26 01:40:14
【问题描述】:
我有一个问题希望你们能帮助我。所以几乎我有一个基本动画,我希望它只在应用程序启动时出现,而不是在我进入应用程序后实际返回页面时出现,因为现在我在 viewWillAppear 方法中拥有它。下面是我的动画代码。任何帮助将不胜感激。
正如您在查看我的代码时可能会说的那样,我正在尝试淡入图像,如果您知道更好的方法,您可以告诉我吗?但这很好用。
我的.m:
#import "HomeViewController.h"
@interface HomeViewController ()
@property (nonatomic,weak) IBOutlet UIImageView *logo;
@end
@implementation HomeViewController
- (void)viewDidAppear:(BOOL)animated
{
[[self logo]setAlpha:0];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:2];
[UIView setAnimationDelay:0];
[[self logo]setAlpha:1];
[UIView commitAnimations];
}
【问题讨论】:
-
放在viewDidLoad中怎么样?
-
或使用
dispatch_once。或者有一些BOOL属性(或static)在你做动画后设置,并且只根据BOOL属性的值再次做那个动画。
标签: uiimageview uiimage iboutlet viewdidappear