Add multiple UIImage copies using UIStepper

135 Views Asked by At

I want to add/delete images in a view using a UIStepper. So every time you press the '+' the same image is copied within the same viewController, still being able to move/rotate every copy.

I have something like this:

- (IBAction)ValueChanged:(UIStepper *)value
{
    NSMutableArray *imageArray = [[NSMutableArray alloc] init];

    int j = (int) value.value;

    for( int i = 0 ; i < j ; ++i )
    {
        UIImageView *newImageView = [[UIImageView alloc] init];
        newImageView.image = self.myImageView.image;
        [imageArray addObject:newImageView];
        [self.view addSubview:imageArray[i]];
    }
}

but this does not work because it just replaces the previous image.

Is there a proper way to copy the same image multiple times using the UIStepper?

0

There are 0 best solutions below