gpt4 book ai didi

iphone - UITapGestureRecognizer 在 UIImageView 中不工作

转载 作者:IT王子 更新时间:2023-10-29 07:54:49 25 4
gpt4 key购买 nike

我有以下代码:

UITapGestureRecognizer *showStoryTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showNewsStory:)];
[showStoryTapRecognizer setDelegate:self];
[self.storyImageView_ addGestureRecognizer:showStoryTapRecognizer];
[showStoryTapRecognizer release];

但这并没有触发 showNewsStory,这是为什么呢?我在 ImageView 中启用了 userInteraction。

最佳答案

您应该为 UIImageView 对象启用用户交互:

[self.storyImageView_ setUserInteractionEnabled:YES];

<罢工>

<罢工>

编辑:

尝试删除

[showStoryTapRecognizer setDelegate:self];

据我所知,我认为 UITapGestureRecognizer 没有它的委托(delegate)方法。

关于iphone - UITapGestureRecognizer 在 UIImageView 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11552184/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com