我的改進代碼..... 我在ViewController.m中編寫下面的代碼viewDidLoad()。它已經叫做我的loadAnimate函數。從UIViewContoller加載UIView
self.classAnimate = [[animateClass alloc] initWithFrame:CGRectMake(0, 340, 320, 80)];
[self.classAnimate loadAnimate];
[self.view addSubview:classAnimate];
但是,當返回不能加載到我的addSubview。我不知道我怎麼在loadAnimate做錯了()函數在animateClass
-(void)loadAnimate
{
NSLog(@"Calling from ViewController file");
animationImages = [NSArray arrayWithObjects:[UIImage imageNamed:@"adv01.png"],
[UIImage imageNamed:@"adv02.png"],
[UIImage imageNamed:@"adv03.png"],nil];
campFireView.animationImages = [NSArray arrayWithArray:animationImages];
NSLog(@"Images inside animationImages are: %@",animationImages);
campFireView.animationDuration = 1.75;
campFireView.animationRepeatCount = 0;
[campFireView startAnimating];
}
只是導入類並定義一個屬性...... – NULL
代碼中沒有loadAnimate類。你在animateClass上有一個'loadAnimate'方法(順便說一句,我希望不是你實際命名的類) – jxpx777