TouchBegan 事件在大量滚动后停止触发

发布于 2024-09-26 18:43:42 字数 832 浏览 2 评论 0原文

我有一系列 UITableViews 显示在水平 ScrollView 中。在每个表视图内,每个 TableViewCell 由 2 个代表详细视图的缩略图图块组成。我正在使用 touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 来捕获其中一个图块被点击的情况。从那里,我将详细视图推送到导航控制器上并显示不同的屏幕。此交互在加载初始视图时起作用。但是,如果您快速上下滚动任何表格视图,touchesBegan 事件就会停止触发。在此期间没有收到内存警告。

这是我在接收点击的视图控制器内部使用的代码(tableviewcell 内部的一个小图块:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    NSLog(@"Touched received on ArticleTileViewController");
    ArticleViewController *vc = [[ArticleViewController alloc] initWithArticleData:self.articleDataArray];
    ProjectAppDelegate *appDelegate = (ProjectAppDelegate *)[UIApplication sharedApplication].delegate;

    [appDelegate.navController pushViewController:vc animated:YES]; 
}

编辑:我也尝试了与 TouchEnded 相同的操作,相同的行为结果。

我在这里遗漏了什么吗?

I have a series of UITableViews displayed in a horizontal ScrollView. Inside each tableview, each TableViewCell consists of 2 thumbnail tiles which represent a detail view. I am using touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event to catch when one of the tiles has been tapped. From there, I am pushing a detail view onto the NavigationController and showing a different screen. This interaction works when the initial view is loaded. However, if you scroll any of the tableviews quickly up and down, the touchesBegan event stops firing. No memory warnings are received during this time.

Here is the code I'm using inside of the view controller which receives the tap (a small tile inside of the tableviewcell:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    NSLog(@"Touched received on ArticleTileViewController");
    ArticleViewController *vc = [[ArticleViewController alloc] initWithArticleData:self.articleDataArray];
    ProjectAppDelegate *appDelegate = (ProjectAppDelegate *)[UIApplication sharedApplication].delegate;

    [appDelegate.navController pushViewController:vc animated:YES]; 
}

EDIT: I've also tried the same thing with touchesEnded, same behavior results.

Am I missing something here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等往事风中吹 2024-10-03 18:43:42

我通过改用 UITapGestureRecognizer 解决了这个问题。实施既快速又简单!

I solved this by switching to using the UITapGestureRecognizer. Implementation was quick and easy!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文