
Then write a code similar to:
@interface ImageCell : UICollectionViewCell @property (strong) UIImageView *imageView; @end @implementation ImageCell - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; self.imageView = [UIImageView new]; [self addSubview:self.imageView]; return self; } - (void)layoutSubviews { [super layoutSubviews]; self.imageView.frame = self.bounds; } @end
Then:
This code needs to be optimized from here depending on the requirements of the application. It is also necessary to customize the frame and layout of the collection to meet the requirements of the user interface.

source share