如果您正在使用AssetsLibrary你可以这样写代码
- (void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
UIImagePickerController *imagePicker;
if (buttonIndex < 2)
{
self.library = [[[ALAssetsLibrary alloc] init] autorelease];
self.imageEditor = [[[DemoImageEditor alloc] initWithNibName:@"DemoImageEditor" bundle:nil] autorelease];
self.imageEditor.doneCallback = ^(UIImage *editedImage, BOOL canceled){
if(!canceled)
{
anotherImage = true;
NSString *imageName;
imageName [email protected]"Abc.jpg";
UIImageWriteToSavedPhotosAlbum(editedImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
editedImage = [self scaleImage:editedImage toSize:CGSizeMake(600,600)];
[[NSUserDefaults standardUserDefaults] setObject:UIImagePNGRepresentation(editedImage)forKey:@"image"];
}
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
UIAlertView *alert;
if (error)
alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Unable to save image to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
else
alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"Image saved to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert release];
}
这将解决你的情况。
您是否检查过[this](http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/)? – TheTiger
是啊,我刚才看到了这个,但看看@Vignesh回答下的评论:) – cojoj