123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- //
- // YOUPAIZYUserZiLiaoDTCell.m
- // VQU
- //
- // Created by 肖浩然的mac on 2021/7/10.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAIZYUserZiLiaoGRXXCell.h"
- #import "YOUPAIZYUserZiLiaoGRXXContentCell.h"
- #import "YOUPAILCDynamicArrayModel.h"
- #import "YOUPAILCUserShowModel.h"
- @interface YOUPAIZYUserZiLiaoGRXXCell()<UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource>
- @property (nonatomic, strong) UICollectionView *youpaipcollectionView;
- @end
- @implementation YOUPAIZYUserZiLiaoGRXXCell
- -(instancetype)initWithFrame:(CGRect)frame{
-
- if (self = [super initWithFrame:frame]) {
- [self youpaifsetSubView];
- }
- return self;
- }
- -(void)youpaifsetSubView{
- UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
- flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
- self.youpaipcollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
- [self.contentView addSubview:self.youpaipcollectionView];
- [self.youpaipcollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(9);
- make.left.mas_offset(12.f);
- make.right.mas_offset(-12);
- make.bottom.mas_offset(0.f);
- }];
-
- self.youpaipcollectionView.backgroundColor = [UIColor whiteColor];
- self.youpaipcollectionView.showsVerticalScrollIndicator = NO;
- self.youpaipcollectionView.showsHorizontalScrollIndicator = NO;
- self.youpaipcollectionView.bounces = NO;
-
- [self.youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoGRXXContentCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoGRXXContentCell class])];
-
- self.youpaipcollectionView.delegate = self;
- self.youpaipcollectionView.dataSource = self;
-
- }
- -(void)setYoupaipalbumArray:(NSArray *)albumArray{
-
-
- }
- #pragma mark <UICollectionViewDataSource>
- /**
- 返回区数
-
- @param collectionView 集合视图
- @return 返回区数
- */
- - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
- return 1;
- }
- /**
- 返回项目数
-
- @param collectionView 集合视图
- @param section 区
- @return 项目数
- */
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
-
-
- return self.youpaipaArr.count;
- }
- -(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
- // NSString *imageUrl = self.albumArray[indexPath.item];
- YOUPAIZYUserZiLiaoGRXXContentCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoGRXXContentCell class]) forIndexPath:indexPath];
- YOUPAIBasicInfo *model = self.youpaipaArr[indexPath.item];
- cell.youpaiTitle.text = model.youpaiptitle;
- cell.youpaiContent.text = model.youpaipvalue;
- if ([model.youpaiptitle isEqualToString:@"性别"]) {
- if ([model.youpaipvalue isEqualToString:@"1"]) {
- cell.youpaiContent.text = @"女";
- }else{
- cell.youpaiContent.text = @"男";
- }
- }
-
- if (self.youpaipaArr.count == indexPath.item+1) {
- cell.youpaicopyBtn.hidden = NO;
- }else{
- cell.youpaicopyBtn.hidden = YES;
- }
-
- return cell;
- }
- -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
- if ([self.youpaipdelegate respondsToSelector:@selector(youpaifGRXXDidCellOrBtnclick)]) {
- [self.youpaipdelegate youpaifGRXXDidCellOrBtnclick];
- }
- YOUPAIBasicInfo *model = self.youpaipaArr[indexPath.item];
- if (self.youpaipaArr.count == indexPath.item+1) {
- UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
- pasteboard.string = model.youpaipvalue;
- [ZCHUDHelper showTitle:@"复制成功,快去粘贴吧!"];
- }
-
- }
- #pragma mark UICollectionViewDelegateFlowLayout
- /**
- 项目大小
-
- @param collectionView 集合视图
- @param collectionViewLayout 布局
- @param indexPath 布局
- @return 大小
- */
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
- return CGSizeMake(111, 49);
- }
- #pragma mark - X间距
- - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
- return 9.0;
- }
- //设置段落的内边距
- - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
- {
- return UIEdgeInsetsMake(0,0,9,0);//UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right)
- }
- @end
|