-(void)longPressAction
{
NSLog(@"发生长按手势");
CGImageRef UIGetScreenImage();
CGImageRef img = UIGetScreenImage();
self.imgView= [UIImage imageWithCGImage:img];
UIActionSheet *actionsheet = [[UIActionSheet alloc]
initWithTitle:@"保存图片到相册?"
delegate:self
cancelButtonTitle:@"取消"
destructiveButtonTitle:@"确定"
otherButtonTitles: nil];
[actionsheet showInView:self];
actionsheet = nil;
}
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex != [actionSheet cancelButtonIndex] ) {
UIImageWriteToSavedPhotosAlbum(self.imgView.image, self, nil, nil);
}
return;
}