修改了礼物面板显示送礼物头像不明显的问题

This commit is contained in:
fengshuo
2022-03-08 10:50:00 +08:00
parent b4a8c7de2d
commit cd916efd0f
3 changed files with 40 additions and 12 deletions

View File

@@ -77,11 +77,14 @@
if(attributes.representedElementKind != nil){
return;
}
CGFloat minLine = self.minimumLineSpacing;
CGFloat minSpacing = self.minimumInteritemSpacing;
//attributes
CGFloat itemW = attributes.frame.size.width;
//attributes
CGFloat itemH = attributes.frame.size.height;
UIEdgeInsets sectionInsets = self.sectionInset;
//collectionView
CGFloat width = self.collectionView.frame.size.width;
//collectionView
@@ -116,9 +119,9 @@
//xitem
CGFloat xCellOffset = remain * itemW;
CGFloat xCellOffset = remain * (itemW + minLine)+ sectionInsets.left;
//yitem
CGFloat yCellOffset = merchant * itemH;
CGFloat yCellOffset = merchant * (itemH + minSpacing);
//sectionitem
NSInteger pageRe = (itemCount % allCount == 0)? (itemCount / allCount) : (itemCount / allCount) + 1;

View File

@@ -20,6 +20,8 @@
@interface XPGiftUserCollectionViewCell ()
///
@property (nonatomic,strong) NetImageView *avatarImageView;
///
@property (nonatomic,strong) UIView * coverView;
///
@property (nonatomic,strong) UILabel *positionLabel;
@end
@@ -37,6 +39,7 @@
#pragma mark - Private Method
- (void)initSubViews {
[self.contentView addSubview:self.avatarImageView];
[self.contentView addSubview:self.coverView];
[self.contentView addSubview:self.positionLabel];
}
@@ -46,6 +49,10 @@
make.width.height.mas_equalTo(38);
}];
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.avatarImageView);
}];
[self.positionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(10);
make.centerY.mas_equalTo(self.avatarImageView.mas_bottom);
@@ -82,8 +89,12 @@
self.avatarImageView.imageUrl = _userInfo.avatar;
if (_userInfo.isSelect) {
self.avatarImageView.layer.borderWidth = 2;
self.coverView.hidden = YES;
self.positionLabel.backgroundColor = [ThemeColor appMainColor];
} else {
self.avatarImageView.layer.borderWidth = 0;
self.coverView.hidden = NO;
self.positionLabel.backgroundColor = [ThemeColor textThirdColor];
}
}
@@ -100,11 +111,21 @@
return _avatarImageView;
}
- (UIView *)coverView {
if (!_coverView) {
_coverView = [[UIView alloc] init];
_coverView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
_coverView.layer.cornerRadius = 38/2;
_coverView.layer.masksToBounds = YES;
}
return _coverView;
}
- (UILabel *)positionLabel{
if (!_positionLabel) {
_positionLabel = [[UILabel alloc] init];
_positionLabel.font = [UIFont systemFontOfSize:8];
_positionLabel.textColor = [ThemeColor mainTextColor];
_positionLabel.textColor = [UIColor whiteColor];
_positionLabel.textAlignment = NSTextAlignmentCenter;
_positionLabel.backgroundColor = [ThemeColor appMainColor];
_positionLabel.layer.masksToBounds = YES;

View File

@@ -111,7 +111,7 @@
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(40 + 105 * 2 + 10 + 10);
make.height.mas_equalTo(40 + 108 * 2 + 10 + 10);
}];
@@ -124,7 +124,13 @@
[self.giftStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.segmentStackView.mas_bottom);
make.left.right.mas_equalTo(self);
make.height.mas_equalTo(105 * 2 + 20);
make.height.mas_equalTo(108 * 2 + 20);
}];
[self.giftcollectionView
mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(108 * 2 + 10);
}];
[self.pageController mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -204,8 +210,8 @@
if (self.segmentType == GiftSegmentType_Pack && self.datasource.count == 0) {
return CGSizeMake(KScreenWidth, 105 * 2 + 10);
}
CGFloat itemWidth = (CGFloat)(KScreenWidth - 10 - 5 * 3) / (CGFloat)4;
return CGSizeMake(itemWidth, 105);
CGFloat itemWidth = (CGFloat)(KScreenWidth - 15 * 2 - 5 * 3) / (CGFloat)4;
return CGSizeMake(itemWidth, 108);
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
@@ -234,7 +240,6 @@
GiftInfoModel * giftInfo= [self.datasource objectAtIndex:indexPath.item];
[self dealSelectGift:giftInfo];
[self.giftcollectionView reloadData];
}
}
@@ -395,10 +400,9 @@
- (UICollectionView *)giftcollectionView{
if (!_giftcollectionView) {
XPGiftCollectionViewFlowLayout *layout = [[XPGiftCollectionViewFlowLayout alloc] init];
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.minimumLineSpacing = 5;
layout.minimumInteritemSpacing = 10;
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 5);
layout.minimumInteritemSpacing = 5;
layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15);
_giftcollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_giftcollectionView.dataSource = self;
_giftcollectionView.delegate = self;