我很困惑。我使用动画帧来使对象移动。代码如下:
campFireView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 80, 63)];
campFireView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"campFire01.png"],
[UIImage imageNamed:@"campFire02.png"],
[UIImage imageNamed:@"campFire03.png"],
[UIImage imageNamed:@"campFire04.png"],
[UIImage imageNamed:@"campFire05.png"],
[UIImage imageNamed:@"campFire06.png"],
[UIImage imageNamed:@"campFire07.png"],
[UIImage imageNamed:@"campFire08.png"],
[UIImage imageNamed:@"campFire09.png"],
[UIImage imageNamed:@"campFire10.png"],
[UIImage imageNamed:@"campFire11.png"],
[UIImage imageNamed:@"campFire12.png"],
[UIImage imageNamed:@"campFire13.png"],
[UIImage imageNamed:@"campFire14.png"],
[UIImage imageNamed:@"campFire15.png"],
[UIImage imageNamed:@"campFire16.png"],
[UIImage imageNamed:@"campFire17.png"], nil];
campFireView.animationDuration =2.5;
campFireView.animationRepeatCount = 0;
[campFireView startAnimating];
[bgview addSubview:campFireView];
[campFireView release]; 请告诉我如何release这样的NSArray?我没有在代码中使用任何alloc,那么如何release这个数组,因为它在我的代码中导致了很多泄漏。
发布于 2011-01-04 17:09:54
如何
release这样的NSArray?
你没有。你的泄漏很可能是在你的代码中的其他地方造成的,因为我在这里看到的不应该是自己泄漏的。
发布于 2011-01-04 17:10:09
该NSArray是自动释放的。如果你真的在漏水,那一定是从别的地方来的。
发布于 2011-01-04 17:28:30
您不必发布NSArray。您可以将其与NSArray arrayWithObjects一起使用。这意味着您不拥有该对象,因此您不必释放它。
https://stackoverflow.com/questions/4591987
复制相似问题