- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我想添加一个 TapGestureRecognizer 来覆盖 UICollectionViewController 的整个屏幕,除了 UICollectionViewCell 单元格。
我得到的最接近的是
-(void) viewDidLoad {
...
UITapGestureRecognizer *tapAnywhere = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(addBoard:)];
[self.collectionView addGestureRecognizer:tapAnywhere];
}
问题:当我点击一个单元格时,不会调用 prepareForSegue 方法。 UITapGestureRecognizer 似乎覆盖了单元格。
UICollectionViewController 中的哪个 View 是附加 GestureRecognizer 以保留其默认单元格“点击以继续”功能的正确 View ?
最佳答案
实现手势识别器委托(delegate)方法
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view isKindOfClass:[UICollectionViewCell class]]) //It can work for any class you do not want to receive touch
{
return NO;
}
else
{
return YES;
}
}
关于ios - 将 TapGestureRecognizer 添加到除 UICollectionView 单元格之外的整个 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19340272/
当我点击第一个 ViewController 中的 UIImageView 时,我正在调用另一个类中的函数: let tapGestureRecognizer = UITapGestureRecogn
所以我有一个自定义 View ,我在 View Controller 的 for 循环中创建了许多 View 。在创建它们时,我对每个它们调用此方法: -(void)setUpStuff{ /
您好,我没有卡片可以用来解决这个问题。我们开始吧。 我有这五个 imageview,这是第一个 imageview 的声明,但基本上它们有相同的声明 @IBOutlet weak var first
嗨,在 viewDidLoad 的主 WiewController 中,我设置了一个 UIGestureRecognizer *recognizer = [[UITapGestureRecognize
我有一个问题。我创建了一个示例项目来解决它,但没有成功。我创建了一个负边距的按钮,位于导航栏的中间。水龙头仅适用于下部。 MainPage.xaml:
我正在 iOS 6.1 上为 iPad 开发一个应用程序。我的 CALayer 和 TapGestureRecognizer 有问题。 我有 7 个 CALayers 形成彩虹(每一层都是一种颜色)。
在我的应用程序中,我有一张图片和一个 UITextView . 我创建了一个 UITapGestureRecognizer对于这两种 View ,但问题是无论我在屏幕上单击什么位置,只有与 UITex
我对 UITableViewCell 进行了子类化。我尝试添加手势识别器,但点击它时没有任何反应。 class MessagesTableViewCell: UITableViewCell {
谁能帮我解决这个错误?不确定它要求什么... TapGestureRecognizer Syntax override func viewDidLoad() { super.viewD
我正在尝试使用 Firebase 构建一个聊天应用程序。我正在尝试实现点击手势,以便在键盘打开时关闭键盘。不幸的是,当您点击屏幕时没有任何反应。我尝试了不同的东西,结果相同。如果有人知道它不起作用的原
这段代码的目的是将 UIView 动画到屏幕上的某个位置。不幸的是,它根本没有注册水龙头。我是否应该将委托(delegate)设置为我的设置中的某些内容?任何帮助将不胜感激! public class
我已经设置了一个点击手势识别器并将识别器添加到 uibutton。该按钮有一个背景图像。当我点击按钮时,它根本不突出显示,我唯一能做的就是更改它的 alpha 值。 UITapGestureReco
我想添加一个 *UITapGestureRecognize*r 到我的 UITextView,因为我想关闭 TextView 所在的“弹出窗口”。所以我想要,当点击 T*extView* 时,将调用
我正在尝试实现 TapGestureRecognizer,它将在 ViewModel (xaml.cs) 中调用,而不是在 View 类中...... 这是 xaml 文件中的示例代码:(IrrigN
我有一个 XF 应用程序,其中定义了以下 Collection View 。第二个标签有一个 TapGestureRecognizer,当我点击标签(在 Android 上尝试这个)时,它不会在模型中
我有一个 XF 应用程序,其中定义了以下 Collection View 。第二个标签有一个 TapGestureRecognizer,当我点击标签(在 Android 上尝试这个)时,它不会在模型中
所以我有一个像照片库一样的应用程序,我正在实现用户删除图像的能力。这是设置:我有 9 个 UIImageView、imageView、imageView2 等。我还有一个“编辑”按钮和一个 tapGe
我正在 swift 3.0 中开发一个项目,我有 UIViewController 来填充一些文本字段。因此,我使用 TableView 作为下拉菜单,一旦选择一行,它将被分配给 UILabel。此外
我正在 swift 3.0 中开发一个项目,我有 UIViewController 来填充一些文本字段。因此,我使用 TableView 作为下拉菜单,一旦选择一行,它将被分配给 UILabel。此外
我有一个 UIToolbarButton,它有一个 UIButton 来保存图像。现在,当我点击这个 UIToolbarButton 时,我想在当前 View 中打开另一个 View 。 我的代码:
我是一名优秀的程序员,十分优秀!