1

here is my code :

-(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);
}

I try to use an array in this code but, it doesn't work, indeed I have never used array, and it would be cool if someone could tell me where is my error ;thank you . sorry for my english I'm french :/

8
  • What is the error you receive? Commented Jul 24, 2011 at 9:07
  • there is no error, but there is no image of "imageView" on the screen Commented Jul 24, 2011 at 9:11
  • How is randomPointSquare implemented? Probably it is putting the image views off screen. Commented Jul 24, 2011 at 9:15
  • no the problem is not from randomPointSquare because it works without my implementation of array, the problem must come from the array Commented Jul 24, 2011 at 9:18
  • @bernard where do you initialize the array? Commented Jul 24, 2011 at 9:22

1 Answer 1

1

You'r missing: imageViewArray = [[NSMutableArray alloc]init];

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.