簡體   English   中英

畫廊將圖像保存到iPhone

[英]Fgallery save image to iPhone

嗨,抱歉,我是菜鳥,但我正在學習。 我的應用程序中有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

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

 [self dismissModalViewControllerAnimated:YES];
}

如果其他人正在尋找答案。 這里是:

FGalleryPhoto *photo = [_photoLoaders objectForKey:[NSString stringWithFormat:@"%i", index]];
UIImage *saveImage = [photo fullsize];

在上面的代碼中,在stringWithFormat方法中,將索引替換為_currentIndex

FGalleryPhoto *照片= [_photoLoaders objectForKey:[NSString stringWithFormat:@“%i”,_currentIndex]]; UIImage * saveImage = [全圖];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM