ios - 在操作表选项中长按

标签 ios objective-c xcode

是否可以在操作表的按钮内使用 UILongPressGestureRecognizer?

如果我触摸或长按,我应该在操作表中做不同的事情吗?

谢谢

最佳答案

是的,你可以

UIActionSheet *action = [[UIActionSheet alloc]initWithTitle:@"title" delegate:(id)self cancelButtonTitle:@"ok" destructiveButtonTitle:@"option" otherButtonTitles:nil, nil];

    [action showInView:self.view];

    UILongPressGestureRecognizer *longtaped = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(recog)];

    [action addGestureRecognizer:longtaped];

它会工作得很好 干杯

关于ios - 在操作表选项中长按,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30436032/

相关文章:

ios - 代码 : Any way to refresh/re-run the playground?

ios - 结束触摸时的按钮事件

xcode - 观看Xcode中的表达式

ios - 将数据传递给 BTsidemenu

具有多行项目的 iOS 选择器控件

ios - iOS 13和Xcode 11-UINavigationBar中断了大标题的滚动

ios - 制作一个iOS浏览器,这个菜单怎么称呼?

iphone - 我的 iPhone 应用程序可以正常运行的链接吗?

objective-c - 关联 UIButton

objective-c - objective-c : calculator app - currentNumber = currentNumber * 10 + digit;