如何在scrollView下调用collectionView的cellForItemAt

问题描述 投票:0回答:1

我的情节提要具有ScrollView和CollectionView。层次结构是这样的

ScrollView
  View
    Button
    TextField
    CollectionView
    Button

在这种情况下,不调用CollectionView的cellForItemAt。但是,当我将CollectionView从ScrollView中移出时,将调用cellForItemAt。

当CollectionView在ScrollView下时如何调用cellForItemAt?

swift storyboard swift5
1个回答
0
投票

检查ScrollView中CollectionView的高度。高度必须大于0才能在CollectionView中调用cellForItemAt

© www.soinside.com 2019 - 2024. All rights reserved.