How could i build an application that first in a blank UIView, then allow users to take a picture using camera, the picture will then appear on the UiView which users can drag and move the image around.
Here is my code that i have so far,
-(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
if((UIButton *) sender == choosePhotoBtn) {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
savebutton.hidden=NO;
}
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
-(void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {
NSString *message; NSString *title;
if (!error) {
title = NSLocalizedString(@"Image Saved Successfully!", @"");
message = NSLocalizedString(@"Tap Library and select this image.", @"");
}
else { title = NSLocalizedString(@"SaveFailedTitle", @""); message = [error description];
} UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:message delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:nil];
[alert show]; [alert release];
[message release]; [title release];}
-(IBAction) saveImage:(id)sender{
UIImage *img = imageView.image;
UIImageWriteToSavedPhotosAlbum(img, self, @selector(imageSavedToPhotosAlbum: didFinishSavingWithError: contextInfo:), nil);
}
Also is there any good tutorial on photo modification in Xcode?
Many Thanks.
Take the help of uitouchmoved class and using the same you can move around the image in the uiview easily.See this.