这是我的代码:
-(void) createImage {
UIImage * image = [UIImage imageNamed:@"abouffer_03.png"];
imageView = [[UIImageView alloc] initWithImage:image];
[imageView setCenter:[self randomPointSquare]];
[imageViewArray addObject:imageView];
[[self view] addSubview:imageView];
[imageView release];
}
-(void)moveImage{
for(int i=0; i< [imageViewArray count];i++){
UIImageView *imageView = [imageViewArray objectAtIndex:i];
imageView.center = CGPointMake(imageView.center.x + X, imageView.center.y + Y);
}
我尝试在这段代码中使用一个数组,但它不起作用,确实我从未使用过数组,如果有人能告诉我错误在哪里,那就太酷了,谢谢。对不起我的英语我是法国人:/
答案 0 :(得分:1)
你错过了:
imageViewArray = [[NSMutableArray alloc]init];