0

嗨对不起,我是菜鸟,但我正在学习。我有 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

4

3 回答 3

0
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
 img.image = [info valueForKey:@"UIImagePickerControllerOriginalImage"];

 [self dismissModalViewControllerAnimated:YES];
}
于 2012-12-11T07:25:07.123 回答
0

如果其他人正在寻找答案。这里是:

FGalleryPhoto *photo = [_photoLoaders objectForKey:[NSString stringWithFormat:@"%i", index]];
UIImage *saveImage = [photo fullsize];
于 2012-12-27T12:51:49.200 回答
0

在上面的代码中,在stringWithFormat方法中,将index替换为_currentIndex

FGalleryPhoto *photo = [_photoLoaders objectForKey:[NSString stringWithFormat:@"%i", _currentIndex]]; UIImage *saveImage = [照片全尺寸];

于 2013-04-27T14:05:29.113 回答