ios – UICollectionViewController如何调整Cell的大小?

ios – UICollectionViewController如何调整Cell的大小?,第1张

概述我通过搜索如何在UICollectionViewController中调整单元格(宽度和高度)来调整问题.使用UITableViewController有方法: - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 但是使用UICollectionViewCont 我通过搜索如何在UICollectionVIEwController中调整单元格(宽度和高度)来调整问题.使用UItableVIEwController有方法:

- (CGfloat)tableVIEw:(UItableVIEw *)tableVIEw heightForRowAtIndexPath:(NSIndexPath *)indexPath

但是使用UICollectionVIEwController,我无法找到以编程方式执行此 *** 作的方法.

我有一个UICollectionVIEwCell,但它显然不存在.

如何更改UICollectionVIEwController中单元格的大小

解决方法 看起来你需要使用UICollectionVIEwFlowLayout和UICollectionVIEwFLowLayoutDelegate并实现

- (CGSize)collectionVIEw:(UICollectionVIEw *)collectionVIEw layout:(UICollectionVIEwLayout*)collectionVIEwLayout sizeforItemAtIndexPath:(NSIndexPath *)indexPath

查看Ray Wenderlich教程:
http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12

总结

以上是内存溢出为你收集整理的ios – UICollectionViewController如何调整Cell的大小?全部内容,希望文章能够帮你解决ios – UICollectionViewController如何调整Cell的大小?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1053415.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存