个人资料页礼物适配大小

This commit is contained in:
eggmanQQQ
2024-06-28 10:54:28 +08:00
parent fc92135ce6
commit c3627d5934
4 changed files with 18 additions and 9 deletions

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "1024*1024 1.png",
"filename" : "1024.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"

View File

@@ -20,8 +20,8 @@
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
NetImageConfig *config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserInfoAlbum;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_imageView = [[NetImageView alloc] initWithConfig:config];
_imageView.layer.masksToBounds = YES;

View File

@@ -51,7 +51,7 @@
[self.contentView addSubview:self.numberImageView];
[self.numberImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.mas_equalTo(8);
make.left.top.mas_equalTo(4);
make.width.height.mas_equalTo(20);
}];
}
@@ -170,12 +170,17 @@
[self.giftsCollectionView reloadData];
}
+ (CGFloat)cellHeight:(BOOL)isExpand source:(NSArray *)dataSource {
+ (CGFloat)cellHeight:(BOOL)isExpand
source:(NSArray *)dataSource {
NSInteger width = (KScreenWidth - 28 - 30)/4;
NSInteger height = width * 120 / 86;
if (isExpand) {
NSInteger line = (dataSource.count / 4) + (dataSource.count % 4 > 0 ? 1 : 0);
return MAX(line * 120 + line * 10, 120);
return MAX(line * height + line * 10, height);
} else {
return 120;
return height;
}
}
@@ -201,8 +206,12 @@
#pragma mark - UICollectionViewDelegateFlowLayout
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(86, 120);
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout *)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
NSInteger width = (KScreenWidth - 28 - 30)/4;
NSInteger height = width * 120 / 86;
return CGSizeMake(width, height);
}
#pragma mark -