2012-10-08 40 views
0

當用戶在圖片視圖上長按時,我如何在照片庫中保存此滾動視圖中的圖片。從圖片庫中的ImageScrollView保存圖片

獲得黃色預警聲明

UIImageWriteToSavedPhotosAlbum(_imageScrollView, self, nil, nil); 

我怎樣才能解決此警告,以節省照片庫中的黃色

- (void)viewDidLoad 

{ self.view.backgroundColor = [UIColor blackColor]; 
UIScrollView *imageScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 
    imageScrollView.pagingEnabled = YES; 
NSInteger numberOfViews = 61; 
for (int i = 0; i < numberOfViews; i++) { 
    CGFloat xOrigin = i * self.view.frame.size.width; 
    NSString *imageName = [NSString stringWithFormat:@"image%d.png", i]; 
    UIImage *image = [UIImage imageNamed:imageName]; 
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; 
    imageView.frame = CGRectMake(xOrigin, 0, self.view.frame.size.width, self.view.frame.size.height); 
    UILongPressGestureRecognizer *gestureRecognizer = [[UILongPressGestureRecognizer alloc] 
               initWithTarget:self 
               action:@selector(handleLongPress:)]; 
    gestureRecognizer.minimumPressDuration = 2.0; 
    imageScrollView.userInteractionEnabled = YES; 
    [imageScrollView addGestureRecognizer:gestureRecognizer]; 
    gestureRecognizer.delegate = self; 
    [gestureRecognizer release]; 
    [imageScrollView addSubview:imageView]; 
    [imageScrollView addSubview:myButton]; 

} 
imageScrollView.contentSize = CGSizeMake(self.view.frame.size.width * numberOfViews, self.view.frame.size.height); 

[self.view addSubview:imageScrollView]; 
[imageScrollView release]; 
} 

- (void)handleLongPress:(UILongPressGestureRecognizer*)gestureRecognizer{ 

if (gestureRecognizer.state == UIGestureRecognizerStateEnded){ 
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Save Photo", nil]; 
    actionSheet.actionSheetStyle = UIActionSheetStyleDefault; 
    [actionSheet showInView:self.view]; 
    [actionSheet release]; 

} 

} 

    -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 
switch (buttonIndex) { 
    case 0: 
     UIImageWriteToSavedPhotosAlbum(_imageScrollView, self, nil, nil); 

     break; 

    default: 
     break; 
} 
} 

在收到警告這句話

 UIImageWriteToSavedPhotosAlbum(_imageScrollView, self, nil, nil); 

形象, incompatible pointer types passing UIScrollView to parameter of type UIImage

感謝

回答