uicollectionView委托嵌入UICollectionView时未响应

发布于 2025-01-21 03:21:49 字数 521 浏览 5 评论 0原文

我有一个uiviewController,带有uiscrollview。屏幕的上半部分包含一些标签和文本字段。屏幕的下半部分是uicollectionViewuicollectionView嵌入在滚动浏览中,因此当用户向下滚动时,它们不限于半屏幕尺寸集合视图。

收集视图正常呈现,并且与我以前做过无数次的代表设置。

我故意测试了不同的解决方案,如果将收集视图“直接”添加到UiviewController中,则调用didSelectItematIndex委托方法。当收集视图被添加到ViewController中的ScrollView中时,我不会从委托方法中得到响应。

我已经检查了DEBUG视图Heirarchy,并且ScrollView内容大小足以容纳整个CollectionView。调试视图还显示正确的视图为uicollectionViewDelegate

任何帮助将不胜感激。

I have a UIViewController with a UIScrollView. The top half of the screen contains some labels and text fields. The lower half of the screen is the UICollectionView. The UICollectionView is embedded within the scrollview so that when the user scrolls down they are not limited to a half screen size collection view.

The collection view is presenting properly and the delegate is set as I've done countless times before.

I've purposely tested different solutions and if the collection view is added 'directly' to the UIViewController the didSelectItemAtIndex delegate method is called. When the collection view is added to a scrollView within the ViewController I get no response from the delegate method.

I have checked the Debug View Heirarchy and the ScrollView content size is sufficient to house the entire collectionView. The Debug view also shows the correct view as the UICollectionViewDelegate.

Any help would be appreciated.

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

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

发布评论

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

评论(1

深爱成瘾 2025-01-28 03:21:49

写了一个问题,我解决了我的问题。

作为屏幕上半部分中布局的一部分,我有一个uitapgesturerecognizer添加到uiscrollview endedediting()如果用户单击,请在uitextfield之外。此点击手势是在传递给uicollectionView之前接收到点击的“结束”。

Having written the question I worked out my issue.

As part of the layout within the first half of the screen, I have a UITapGestureRecognizer added to the UIScrollView to endEditing() should the user click outside of a UITextField. This tap gesture was receiving the tap and 'ending it' before it was passed to the UICollectionView.

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