修改了送礼物麦序排序的问题 普通礼物列表错误的问题

This commit is contained in:
fengshuo
2021-12-03 14:58:41 +08:00
parent e6f0a132fd
commit 6730d83ca9
3 changed files with 18 additions and 28 deletions

View File

@@ -22,8 +22,6 @@
@property (nonatomic,strong) NetImageView *avatarImageView;
///
@property (nonatomic,strong) UILabel *positionLabel;
///
@property (nonatomic,strong) UIView * coverView;
@end
@implementation XPGiftUserCollectionViewCell
@@ -36,16 +34,10 @@
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
self.coverView.layer.cornerRadius = self.coverView.frame.size.width / 2;
}
#pragma mark - Private Method
- (void)initSubViews {
[self.contentView addSubview:self.avatarImageView];
[self.contentView addSubview:self.positionLabel];
[self.contentView addSubview:self.coverView];
}
- (void)initSubViewConstraints {
@@ -60,10 +52,6 @@
make.width.mas_equalTo(10);
make.centerX.mas_equalTo(self.avatarImageView);
}];
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.contentView);
}];
}
#pragma mark - Getters And Setters
@@ -83,7 +71,11 @@
}
}
self.avatarImageView.imageUrl = _userInfo.avatar;
self.coverView.hidden = _userInfo.isSelect;
if (_userInfo.isSelect) {
self.avatarImageView.layer.borderWidth = 2;
} else {
self.avatarImageView.layer.borderWidth = 0;
}
}
- (NetImageView *)avatarImageView {
@@ -94,6 +86,7 @@
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 38/2;
_avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor;
}
return _avatarImageView;
}
@@ -111,14 +104,4 @@
return _positionLabel;
}
- (UIView *)coverView {
if (!_coverView) {
_coverView = [[UIView alloc] init];
_coverView.backgroundColor = [ThemeColor avatarCoverColor];
_coverView.layer.masksToBounds = YES;
_coverView.layer.cornerRadius = 43/2;
}
return _coverView;
}
@end

View File

@@ -291,7 +291,7 @@
[_normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.giftType == GiftType_Lucky) {
[luckyArray addObject:obj];
} else {
} else if(obj.giftType == GiftType_Game) {
[normaleArray addObject:obj];
}
}];

View File

@@ -111,8 +111,15 @@
- (NSArray *)findSendGiftAllUsers:(NSArray<XPGiftUserInfoModel *> *)users {
NSMutableArray * tempArray = [NSMutableArray array];
NSString * uid = [AccountInfoStorage instance].getUid;
for (int i = 0; i < users.count; i++) {
XPGiftUserInfoModel * userInfo = [users objectAtIndex:i];
NSArray * newArray = [users sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
XPGiftUserInfoModel * model1 = obj1;
XPGiftUserInfoModel * model2 = obj2;
NSComparisonResult resuest = [model1.position compare:model2.position];
return resuest;
}];
for (int i = 0; i < newArray.count; i++) {
XPGiftUserInfoModel * userInfo = [newArray objectAtIndex:i];
if (userInfo && userInfo.uid > 0 && userInfo.uid != uid.integerValue) { ///
NSString * uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
if (userInfo.isSelect) {
@@ -230,8 +237,8 @@
- (UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(43, 43);
layout.minimumLineSpacing = 1;
layout.itemSize = CGSizeMake(38, 43);
layout.minimumInteritemSpacing = 4;
layout.sectionInset = UIEdgeInsetsMake(0, 0, 0,0);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.dataSource = self;