Hello,
I want to take a photo or select from the photo album in my app, and then save it. Actually for me very hard task...
The problem is that I created a class for the ImagePickerDelegate, looks like follow:
#import <Foundation/Foundation.h>
@interface MyImagePickerDelegate : NSObject <UINavigationControllerDelegate, UIImagePickerControllerDelegate >{
UIImage * selectedImage;
}
@property (nonatomic, retain) UIImage * selectedImage;
@end
and the implementation is:
#import "MyImagePickerDelegate.h"
@implementation MyImagePickerDelegate
@synthesize selectedImage;
- (void) imagePickerControllerDidCancel: (UIImagePickerController *) picker {
[picker.parentViewController dismissModalViewControllerAnimated: YES];
[picker release];
}
- (void)imagePickerController

UIImagePickerControll er *) picker didFinishPickingMediaWithInfo

NSDictionary *) info {
self.selectedImage = (UIImage*)[info objectForKey:UIImagePickerControllerOriginalImage];
//[[NSNotificationCenter defaultCenter] postNotificationName:@"ImagePicked" object:nil];
[picker.parentViewController dismissModalViewControllerAnimated:YES];
[picker release];
[[NSNotificationCenter defaultCenter] postNotificationName:@"ImagePicked" object:nil];
}
- (void) dealloc {
[selectedImage release];
[super dealloc];
}
@end
It's looks OK...
I have a main window with a UITableView and depending of the row selection I call the function that follows:
- (void) selectPicture{
UIImagePickerController * pickCont = [[UIImagePickerController alloc] init];
pickCont.delegate = imgPickerDelegate;
pickCont.allowsImageEditing = YES;
pickCont.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController

ickCont animated:YES];
NSLog(@"heynow");
if(self.imgPickerDelegate.selectedImage != nil){
//[self changeImage];
}
}
All works fine, the photo albums opens and allow me to select a picture from my album but...
I put a breakpoint in function didFinishPickingMediaWithInfo in myImagePickerDelegate but the code execution never stop there! And there is where I want to mange what to do with the image.
I hope you can help me!
Sorry with me english!