草庐IT

collectionview1

全部标签

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移

ios - UICollectionViewTransitionLayout - 模仿 iOS7 照片 collectionview 布局

我在读苹果guidelines在animatingchangesinacollectionview,试图模仿照片应用程序。选择图像时,图像会从它在CollectionView中所在的区域“增长”到全尺寸View。Apple注意到使用UICollectionViewLayout对象,但对我来说它看起来非常困惑,而且全尺寸图库中的最终图像不可见,因为动画以collectionview为中心。我的代码如下-(void)setHorizontalLayout:(BOOL)layout{if(layout==YES){UICollectionViewTransitionLayout*layout