草庐IT

collectionViews

全部标签

ios - collectionView/TableView 中某个部分中没有数据的模式

我正在考虑在collectionView/TableView中显示没有特定部分数据的通知的推荐方式一种方法是创建一个特殊的单元格并将其放入而不是数据单元格中。这感觉很奇怪,因为“空通知”单元格与数据不相关,这意味着我需要在didSelectItem中传播很多条件,配置单元格等使用https://github.com/dzenbot/DZNEmptyDataSet仅当整个View为空时才适用,而不是在特定部分另一种方法是(这就是我现在所做的)将UIView插入数据将作为collectionview的subview的位置,但这也需要在重新加载数据、滚动、点击时进行维护。此外,这需要计算放置

ios - CollectionView 窗口保持黑色

我正在编写iOS应用程序。我有CollectionView窗口,在其中通过拖放添加了一个customCell。当我运行应用程序时,CollectionView窗口的一部分是黑色的。集合可重用View标识符设置为“ItemCell”。自定义View单元设置为“CustomViewCell”类。CollectionView的数据源和委托(delegate)已设置为FirstViewController。那是代码:FirstViewcontroller:#import#import"CustomViewCell.h"@interfaceFirstViewController:UIViewCo

ios - 如何检查collectionview是否为空xcode

我有一个CollectionView。我想做这个:如果没有图像添加到CollectionView,我希望ImageView可见。但是如果有1个或多个图像添加到集合中,我希望imageview变得不可见 最佳答案 尝试在viewDidLoad以及CollectionView可以修改其内容的任何地方调用此方法。如果假设您已将IBOutlets连接到您的UICollectionView和UIImageView:-(void)showAppropriateView{intnumberOfItemsInCollection=[collecti

CollectionView自定义单元格在单元外访问侵略性

我正在尝试在单元外的收集视图中更改自定义视图单元格的某些属性,但是我无法弄清楚我在做什么错:在Cellforitem中,我有:funccollectionView(_collectionView:UICollectionView,cellForItemAtindexPath:IndexPath)->UICollectionViewCell{letcell=collectionView.dequeueReusableCell(withReuseIdentifier:"PatientProfileCell",for:indexPath)as!PatientQuestionCellifAuth.au

iOS 将 scrollView 和 collectionView 委托(delegate)分离到单独的文件中

我有一个UICollectionView并且希望能够在用户滚动通过实现scrollView委托(delegate)方法时执行自定义行为。在使用collectionView时,是否可以有两个单独的对象充当collectionView委托(delegate)和scrollView委托(delegate)? 最佳答案 您不能有单独的代表。UICollectionView是UIScrollView的子类,并重写其delegate属性以将其类型更改为UICollectionViewDelegate(这是一个UIScrollViewDelega

ios - 如何将 collectionview 单元格扩展到全屏

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭6年前。Improvethisquestion我正在尝试全屏打印图像我使用了UICollectionViewDelegateFlowLayout这是我的代码funccollectionView(_collectionView:UICollectionView,layoutcollectionView

ios - 有没有办法确定 self.collectionview.visiblecells 的顺序?

在CollectionView中,我想知道CollectionView中显示的第一项。我想我会查看visibleCells并将成为列表中的第一项,但事实并非如此。 最佳答案 针对Swift5进行了更新letvisibleCells=self.collectionView.indexPathsForVisibleItems.sorted{left,right->Boolinreturnleft.sectionUICollectionViewCell?inreturnself?.collectionView.cellForItem(at

ios - appname.ViewsVC collectionView :cellForItemAtIndexPath:]: unrecognized selector sent to instance

我正在构建一个CollectionView并收到以下错误。Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'-[appname.ViewsVCcollectionView:cellForItemAtIndexPath:]:unrecognizedselectorsenttoinstance这是我自定义单元格的代码//cellconfigurationfunccollectionView(_collectionView:UICollectionView,cellForItemAtindexPa

ios - 隐藏导航栏时,使用带有水平滚动的 CollectionView 的 interactivepopgesturerecognizer

我正在尝试使用interactivepopgesturerecognizer返回一个View,其中我还有一个水平滚动的UICollectionView,问题是在CollectionView的框架中,滑动返回不起作用,但是当触摸开始超出CollectionView的框架时有效,这是我的View的一个例子:|--->hereworks|-----------||--->Thisisthecollectionviewanddoesn'tswipetogoback||-----------|--->hereworks我该如何解决这个问题?编辑:我意识到只有在推送View中导航栏被隐藏时才会出现

iOS : ScrollView delegate method inside of CollectionView not call

首先我在.h文件中设置了delegate@interfaceViewController:UIViewController之后只需在collectionview.m文件中调用此方法-(void)scrollViewDidScroll:(UIScrollView*)scrollView{NSLog(@"scrollViewDidScroll");}但不调用这个方法。 最佳答案 简单一点在.m文件中添加以下行yourCollectionView.delegate=self;及下方添加.hUICollectionViewDelegate移