123456789101112131415161718192021222324252627282930313233343536373839 |
- //
- // YOUPAISYBaseCollectionCell.m
- // VQU
- //
- // Created by leo on 2020/4/21.
- // Copyright © 2020 leo. All rights reserved.
- //
- #import "YOUPAISYBaseCollectionCell.h"
- #import <objc/runtime.h>
- @implementation YOUPAISYBaseCollectionCell
- + (instancetype)youpaifcellWithCollectionViewCell:(UICollectionView *)collectionView indexPath:(NSIndexPath *)indexPath {
- NSString *className = NSStringFromClass([self class]);
- id rigistedClass = objc_getAssociatedObject(self, (__bridge const void * _Nonnull)(className));
- if (!rigistedClass) {
- [collectionView registerClass:[self class] forCellWithReuseIdentifier:className];
- rigistedClass = NSStringFromClass([self class]);
- objc_setAssociatedObject(self, (__bridge const void * _Nonnull)(className), rigistedClass, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
- }
-
- UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:className forIndexPath:indexPath];
-
- return (YOUPAISYBaseCollectionCell *)cell;
- }
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- [self youpaifsetupUI];
- }
-
- return self;
- }
- - (void)youpaifsetupUI {
-
- }
- @end
|