lianlianbushell 2013-02-27 05:28 采纳率: 0%
浏览 2301
已采纳

确认UIGestureRecognizer

大家好,请教一个关于UIGestureRecognizer的问题。

比如我需要在用户在操作之后,用UIAlertView来确认提交动作,我试过一些方法都没成功。

清高手帮忙解决一下,谢谢。

  • 写回答

1条回答

  • gaoXxxing 2013-02-27 07:42
    关注

    这样:

    UISwipeGestureRecognizer *gesture1 = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipeRight:)];
    gesture1.direction = UISwipeGestureRecognizerDirectionRight;
    [yourView addGestureRecognizer:gesture1];
    

    在Action方法中:

    -(void)didSwipeLeft:(UIGestureRecognizer *)gestureRecognizer {
        UIAlertView *Alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Are you sure to commit with its action" delegate:self cancelButtonTitle:CKString(@"NO") otherButtonTitles:CKString(@"YES"),nil];
        [Alert show];
        Alert.tag=222;
        Alert.delegate=self;
        [Alert release];
    }
    

    在AlertView Delegate

    -(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    
        if(alertView.tag==222) {
            if(buttonIndex==1)
            {
                //// Yes condition
            } else {
               ///// No condition
            }
        }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题