欢迎光临
我们一直在努力

DynamicHeightForCollectionView

建站超值云服务器,限时71元/月

DynamicHeightForCollectionView

项目介绍:

UICollectionView 动态高度适配框架

Dynamic Height For UICollectionView
–

  • Simple solution for Dynamically adjust view as a blocks.
    用于动态地将视图调整为块的简单解决方案。

  • Dynamically adjust height of collection view.
    动态调整uicollectionview的高度

  • No more White spaces
    没有更多的空格

Difference between Normal CollectionView Layout and Custom CollectionView Layout
正常CollectionView布局和自定义CollectionView布局之间的区别

–

While using Dynamic height only While using Dynamic height with Custom Layout Made by Me
ScreenShot ScreenShot

How to get Custom CollectionView Layout for your UICollectionView
–
Add Following Files to your project
–

  • customLayout.h

  • customLayout.m

Import customLayout in your controller where to use
–

#import "customLayout.h"

And use

<customLayoutDelegate> 

to your controller.

Write Simple Code in your viewDidLoad Method
–


    columncount=2; // How much Columns you required
    miniInteriorSpacing=10; // Minimum Spacing you required
    
    if(![collectionView.collectionViewLayout isKindOfClass:[customLayout class]]){
        customLayout *layout = [customLayout new];
        layout.delegate=self;
        layout.columnCount=columncount;
        
        collectionView.collectionViewLayout = layout;
        
        [collectionView reloadData];
    } 

For getting height of Label I have written a method.

-(float)calculateHeightForLbl:(NSString*)text width:(float)width;

code4app

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » DynamicHeightForCollectionView
分享到: 更多 (0)