Latest 1.0.4
Homepage https://github.com/GreedBell/UICollectionView-ARDynamicHeightLayoutCell
License MIT
Platforms ios
Frameworks UIKit, Foundation
Authors ,

Fork

fork from UICollectionView-ARDynamicHeightLayoutCell of version v1.0

UICollectionView+ARDynamicHeightLayoutCell

  • An simple category for caculating autolayout UICollectionViewCell size. Automatic manage cell’s size cache, automatic invalidate, most improve efficiency.

Demo gif

UICollectionView-ARDynamicHeightLayoutCell_Bell
UICollectionView-ARDynamicHeightLayoutCell_Bell

Support

  • A prototype cell in storyboard

  • -registerNib:forCellReuseIdentifier:

  • -registerClass:forCellReuseIdentifier:

Usage

if your cell use autolayout , all you need just to do like this:

Fixed width

#import "UICollectionView+ARDynamicHeightLayoutCell.h"

-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return [collectionView ar_sizeForCellWithIdentifier:@"DynamicHeightCell" fixedWidth:300 configuration:^(id cell) {

       //configuration your cell
        FeedModel *feed = self.feeds[indexPath.row];
        [cell filleCellWithFeed:feed];

    }];
}

Fixed height

#import "UICollectionView+ARDynamicHeightLayoutCell.h"

-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return [collectionView ar_sizeForCellWithIdentifier:@"DynamicHeightCell" fixedHeight:400 configuration:^(id cell) {
        //configuration your cell
           FeedModel *feed = self.feeds[indexPath.row];
           [cell filleCellWithFeed:feed];
    }
}

Dynamic size

#import "UICollectionView+ARDynamicHeightLayoutCell.h"

-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return [collectionView ar_sizeForCellWithIdentifier:@"DynamicHeightCell" configuration:^(id cell) {
        //configuration your cell
           FeedModel *feed = self.feeds[indexPath.row];
           [cell filleCellWithFeed:feed];
    }
}

Install

pod ‘UICollectionView-ARDynamicHeightLayoutCell_Bell’

Change Log

CHANGELOG

LICENSE

MIT

Latest podspec

{
    "name": "UICollectionView-ARDynamicHeightLayoutCell_Bell",
    "version": "1.0.4",
    "summary": "Automatically UICollectionViewCell size calculating.",
    "description": "A longer description of UICollectionView-ARDynamicHeightLayoutCell in Markdown format.nn* Think: Why did you write this? What is the focus? What does it do?n* CocoaPods will be using this to generate tags, and improve search results.n* Try to keep it short, snappy and to the point.n* Finally, don't worry about the indent, CocoaPods strips it!",
    "homepage": "https://github.com/GreedBell/UICollectionView-ARDynamicHeightLayoutCell",
    "license": "MIT",
    "authors": {
        "August": "[email protected]",
        "Bell": "[email protected]"
    },
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/GreedBell/UICollectionView-ARDynamicHeightLayoutCell.git",
        "tag": "1.0.4"
    },
    "source_files": [
        "UICollectionView+ARDynamicHeightLayoutCell",
        "UICollectionView+ARDynamicHeightLayoutCell/**/*.{h,m}"
    ],
    "exclude_files": "UICollectionView+ARDynamicHeightLayoutCell/Exclude",
    "frameworks": [
        "UIKit",
        "Foundation"
    ]
}

Pin It on Pinterest

Share This