嗨对不起,我是菜鸟,但我正在学习。我有 Fgallery 在我的应用程序中工作,但现在我想将一个条形按钮连接到一个动作以将图像保存到手机。我需要一些代码来提供当前图像(在大图像视图中)我希望有人可以帮助我解决这个问题。这就是我所拥有的:
- (void)handleEditCaptionButtonTouch:(id)sender {
// here we could implement some code to change the caption for a stored image
[networkGallery saveImageAtIndex:[networkGallery currentIndex]];
}
在这里我有一个硬编码的图像,但我需要当前图像:
- (void)saveImageAtIndex:(NSUInteger)index
{
UIImage *image = [UIImage imageNamed:@"background.png"];
if(image != nil){
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
}
return;
}
//saveImage method
-(void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{
[BT_debugger showIt:self:[NSString stringWithFormat:@"finished saving image: %@", @""]];
NSString *message;
NSString *title;
if (!error) {
title = NSLocalizedString(@"SaveSuccessTitle", @"");
message = NSLocalizedString(@"SaveSuccessMessage", @"");
} else {
title = NSLocalizedString(@"SaveFailedTitle", @"");
message = [error description];
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:nil
cancelButtonTitle:NSLocalizedString(@"ButtonOK", @"")
otherButtonTitles:nil];
[alert show];
[alert release];
}
任何帮助将不胜感激。
在此先感谢 DK