2011-12-11 3 views
0

나는 앞으로 그리고 내 앞으로 슬쩍 수있는 내 현재 이미지가 있습니다. 모든 이미지는 pages 폴더에 있습니다. 따라서 현재보기에서 현재 이미지를 사진 앨범에 저장하는 IBAction이 있습니다. 해당 작업을 구현하는 방법? 나는 이것을 연구했지만 시작하는 법을 모르며 붙어 있습니다.iOS : 현재 UIView에서 현재 이미지를 사진 앨범에 저장하는 방법은 무엇입니까? UIImageWriteToSavedPhotosAlbum와 붙어 있습니다.

M 파일 :

내가 UIImage.h

정의
void UIImageWriteToSavedPhotosAlbum (
    UIImage *image, 
); 

- (IBAction)saveMe{ 

    [UIImageWriteToSavedPhotosAlbum]; 

} 

내 개정 코드 :

-(IBAction) saveToPhotoAlbum{ 




} 

- (void) imageViewController:(UIImageView *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 

    UIImage *image = //i have 6 current UIImageview on my current main view. How do I get stated? 



    UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil); 






    [picker release]; 
} 




- (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 show]; 
    [alert release]; 
} 

답변

3

그리기 UIView의 상황에

UIGraphicsBeginImageContext(size); 
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; 
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 

및 저장에 대한 UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);를 사용 ~에 앨범

+0

나는 그것을 구현하려고합니다. 나는 너에게 돌아갈 것이다. – Amink

+0

현재 UIImage보기를 320x240으로 설정하고 IBAction이 원래의 1024 크기를 디렉토리 링크에서 저장하는 것입니다. 그렇게하는 방법? – Amink

관련 문제