0

当长按 2 秒时,它应该会显示带有保存照片按钮的操作表,但操作表未显示。

 UILongPressGestureRecognizer *gestureRecognizer = [[UILongPressGestureRecognizer alloc]
                                               initWithTarget:self
                                               action:@selector(handleLongPress:)];
    gestureRecognizer.minimumPressDuration = 2.0;
     imageScrollView.userInteractionEnabled = YES;
     [imageScrollView addGestureRecognizer:gestureRecognizer];
    gestureRecognizer.delegate = self;
    [gestureRecognizer release];

- (void)handleLongPress:(UILongPressGestureRecognizer*)gestureRecognizer{
if (gestureRecognizer.state == UIGestureRecognizerStateBegan){
    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(imageView, self, @selector(image: didFinishSavingWithError:contextInfo:), nil);

        break;

    default:
        break;
}
}

我在代码中做错了什么。

感谢帮助。

4

0 回答 0