草庐IT

UiCollectionView

全部标签

ios - CollectionView 中的自定义单元格重新排序行为

我可以像这样重新排序我的collectionView:但是,我不想让所有单元格都水平移动,而是想交换以下行为(即单元格的混洗较少):我一直在使用以下委托(delegate)方法:funccollectionView(_collectionView:UICollectionView,targetIndexPathForMoveFromItemAtoriginalIndexPath:IndexPath,toProposedIndexPathproposedIndexPath:IndexPath)->IndexPath但是,我不确定如何实现自定义重新排序行为。 最

ios - CollectionView 中的自定义单元格重新排序行为

我可以像这样重新排序我的collectionView:但是,我不想让所有单元格都水平移动,而是想交换以下行为(即单元格的混洗较少):我一直在使用以下委托(delegate)方法:funccollectionView(_collectionView:UICollectionView,targetIndexPathForMoveFromItemAtoriginalIndexPath:IndexPath,toProposedIndexPathproposedIndexPath:IndexPath)->IndexPath但是,我不确定如何实现自定义重新排序行为。 最

ios - 在 UICollectionViewCell 中处理 ScrollView 大小

我正在制作一个水平的UICollectionView,在UICollectionViewCell里面我有ScrollView,在ScrollView里面我有一个imageView。我遇到的问题是,当我放大imageView时,scrollView占用了所有单元格大小,因此它不适合图像大小的高度和宽度。因此,通过上下滚动,图像从scrollview中消失,我不知道我的代码出了什么问题。我的ColectionViewCell代码:classCollectionViewCell:UICollectionViewCell{@IBOutletvarscrollView:UIScrollView!

ios - 在 UICollectionViewCell 中处理 ScrollView 大小

我正在制作一个水平的UICollectionView,在UICollectionViewCell里面我有ScrollView,在ScrollView里面我有一个imageView。我遇到的问题是,当我放大imageView时,scrollView占用了所有单元格大小,因此它不适合图像大小的高度和宽度。因此,通过上下滚动,图像从scrollview中消失,我不知道我的代码出了什么问题。我的ColectionViewCell代码:classCollectionViewCell:UICollectionViewCell{@IBOutletvarscrollView:UIScrollView!

ios - UICollectionView 3 列网格,1px 空间?? (包括图像)

我设置了一个带有FlowLayout的UICollectionView,它在垂直或水平方向的单元格之间不留空间。我一切正常,但在第2列和第3列之间有一个奇怪的1px空间,我不知道为什么!?我已经验证了1px的差距在iOS模拟器和真实设备上都出现了。有人经历过吗?我的UIViewController是以下各项的委托(delegate)/数据源:MyViewController类:UIViewController、UICollectionViewDelegate、UICollectionViewDataSource、UICollectionViewDelegateFlowLayout我已经

ios - UICollectionView 3 列网格,1px 空间?? (包括图像)

我设置了一个带有FlowLayout的UICollectionView,它在垂直或水平方向的单元格之间不留空间。我一切正常,但在第2列和第3列之间有一个奇怪的1px空间,我不知道为什么!?我已经验证了1px的差距在iOS模拟器和真实设备上都出现了。有人经历过吗?我的UIViewController是以下各项的委托(delegate)/数据源:MyViewController类:UIViewController、UICollectionViewDelegate、UICollectionViewDataSource、UICollectionViewDelegateFlowLayout我已经

ios - 以编程方式创建带有自定义 header 的 UICollectionView

我正在快速制作一个iOS应用程序,并且我正在尝试以编程方式制作一个collectionView。我想使用我自己的UICollectionReusableView子类作为CollectionView的header,因为我需要一些按钮和header中的可拉伸(stretch)图像。SupView是UICollectionReusableView。overridefuncviewDidLoad(){super.viewDidLoad()letlayout=UICollectionViewFlowLayout()layout.headerReferenceSize=CGSizeMake(sel

ios - 以编程方式创建带有自定义 header 的 UICollectionView

我正在快速制作一个iOS应用程序,并且我正在尝试以编程方式制作一个collectionView。我想使用我自己的UICollectionReusableView子类作为CollectionView的header,因为我需要一些按钮和header中的可拉伸(stretch)图像。SupView是UICollectionReusableView。overridefuncviewDidLoad(){super.viewDidLoad()letlayout=UICollectionViewFlowLayout()layout.headerReferenceSize=CGSizeMake(sel

ios - Swift 3.0 中的 NSIndexPath 和 IndexPath

我最近将我的代码转换为Swift3.0。我的CollectionView和TableView数据源方法现在在其方法签名中包含IndexPath而不是NSIndexPath。但仍然在方法定义中,它是将IndexPath类型转换为NSIndexPath。即funccollectionView(_collectionView:UICollectionView,cellForItemAtindexPath:IndexPath)->UICollectionViewCell{letcell:NNAmenitiesOrFurnishingCollectionViewCell=self.ameniti

ios - Swift 3.0 中的 NSIndexPath 和 IndexPath

我最近将我的代码转换为Swift3.0。我的CollectionView和TableView数据源方法现在在其方法签名中包含IndexPath而不是NSIndexPath。但仍然在方法定义中,它是将IndexPath类型转换为NSIndexPath。即funccollectionView(_collectionView:UICollectionView,cellForItemAtindexPath:IndexPath)->UICollectionViewCell{letcell:NNAmenitiesOrFurnishingCollectionViewCell=self.ameniti