0

I'm trying to make some composite images from currently existing ones in the photo rolls. I have code that seems to work that loads an image from the photo roll onto a UIImageView and displays it to the user; (here's the Action that does that:)

- (IBAction)grabImage:(id)sender
{
    if ([_myPopoverController isPopoverVisible])
        [_myPopoverController dismissPopoverAnimated:YES];
     else
    {
        if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeSavedPhotosAlbum])
        {
            UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
            imagePicker.delegate = self;
            imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            imagePicker.mediaTypes = [NSArray arrayWithObjects: (NSString *) kUTTypeImage, nil];
            imagePicker.allowsEditing = NO;
            _myPopoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
            _myPopoverController.delegate = self;
            [_myPopoverController presentPopoverFromRect: [sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES ];
            _newMedia = NO;
        }
    }
}

next I want to be able to select more photos, but instead of replacing the current one I want them to be layered one on top of another. Finally, when the user is done layering images, I want them to be able to save the final product to the photo roll.

How do I implement this? Not sure where to start...

thanks in advance,

marina

pikovayadama
  • 808
  • 2
  • 8
  • 26

1 Answers1

0

It turns out that all that was needed to do this is just add CALayers to an UIImageView with various degrees of alpha; instead of wiping out the previous image and replacing it with a new one, I simply add differently alpha's layers of images. Works like a charm!

pikovayadama
  • 808
  • 2
  • 8
  • 26