uicollectionView委托嵌入UICollectionView时未响应
我有一个uiviewController
,带有uiscrollview
。屏幕的上半部分包含一些标签和文本字段。屏幕的下半部分是uicollectionView
。 uicollectionView
嵌入在滚动浏览中,因此当用户向下滚动时,它们不限于半屏幕尺寸集合视图。
收集视图正常呈现,并且与我以前做过无数次的代表设置。
我故意测试了不同的解决方案,如果将收集视图“直接”添加到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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
写了一个问题,我解决了我的问题。
作为屏幕上半部分中布局的一部分,我有一个
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 theUIScrollView
toendEditing()
should the user click outside of aUITextField
. This tap gesture was receiving the tap and 'ending it' before it was passed to theUICollectionView
.