礼物面板-惩罚礼物UI
This commit is contained in:
22
xplan-ios/Assets.xcassets/Gift/gift_type_newIcon.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Gift/gift_type_newIcon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "gift_type_newIcon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "gift_type_newIcon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Gift/gift_type_newIcon.imageset/gift_type_newIcon@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Gift/gift_type_newIcon.imageset/gift_type_newIcon@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 533 B |
BIN
xplan-ios/Assets.xcassets/Gift/gift_type_newIcon.imageset/gift_type_newIcon@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Gift/gift_type_newIcon.imageset/gift_type_newIcon@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 846 B |
@@ -19,6 +19,7 @@ typedef NS_ENUM(NSUInteger, GiftType) {
|
||||
GiftType_WeekStar = 8, //周星礼物
|
||||
GiftType_Graffiti = 10, //涂鸦礼物
|
||||
GiftType_Anchor = 11, //个播礼物
|
||||
GiftType_Punish = 12, //惩罚礼物
|
||||
};
|
||||
|
||||
//礼物类型
|
||||
|
@@ -24,6 +24,8 @@
|
||||
@property (nonatomic, strong) UIImageView *arrowImageView;
|
||||
///互动
|
||||
@property (nonatomic, strong) UIButton *interactButton;
|
||||
///红点
|
||||
@property (nonatomic, strong) UIView *redDotView;
|
||||
///轮播图
|
||||
@property (nonatomic,strong) SDCycleScrollView *cycleScrollView;
|
||||
|
||||
@@ -47,6 +49,7 @@
|
||||
[self addSubview:self.giftButton];
|
||||
[self addSubview:self.devideView];
|
||||
[self addSubview:self.interactButton];
|
||||
[self addSubview:self.redDotView];
|
||||
[self addSubview:self.arrowImageView];
|
||||
[self addSubview:self.cycleScrollView];
|
||||
[self addSubview:self.bottomDevideView];
|
||||
@@ -72,6 +75,11 @@
|
||||
make.left.mas_equalTo(self.devideView.mas_right).mas_offset(8);
|
||||
make.width.mas_equalTo(40);
|
||||
}];
|
||||
[self.redDotView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.interactButton.mas_right).mas_offset(-7);
|
||||
make.bottom.mas_equalTo(self.interactButton.mas_top).mas_offset(9);
|
||||
make.width.height.mas_equalTo(8);
|
||||
}];
|
||||
|
||||
[self.devideView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self);
|
||||
@@ -136,6 +144,7 @@
|
||||
}
|
||||
sender.selected = YES;
|
||||
self.giftButton.selected = NO;
|
||||
self.redDotView.hidden = YES;
|
||||
sender.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold];
|
||||
self.giftButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
|
||||
@@ -185,6 +194,18 @@
|
||||
return _interactButton;
|
||||
}
|
||||
|
||||
- (UIView *)redDotView {
|
||||
if (!_redDotView) {
|
||||
_redDotView = [[UIView alloc] init];
|
||||
_redDotView.backgroundColor = UIColorFromRGB(0xFB486A);
|
||||
_redDotView.layer.cornerRadius = 4;
|
||||
_redDotView.layer.masksToBounds = YES;
|
||||
_redDotView.layer.borderWidth = 1;
|
||||
_redDotView.layer.borderColor = [UIColor whiteColor].CGColor;
|
||||
}
|
||||
return _redDotView;
|
||||
}
|
||||
|
||||
- (UIView *)devideView {
|
||||
if (!_devideView) {
|
||||
_devideView = [[UIView alloc] init];
|
||||
|
@@ -19,6 +19,7 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
|
||||
GiftSegmentType_Pack,///背包礼物
|
||||
GiftSegmentType_Graffiti,///涂鸦礼物
|
||||
GiftSegmentType_Anchor,///个播
|
||||
GiftSegmentType_Punish,///惩罚礼物
|
||||
};
|
||||
|
||||
|
||||
|
@@ -39,6 +39,10 @@
|
||||
@property (nonatomic, strong) UIButton *weekStarButton;
|
||||
///涂鸦礼物
|
||||
@property (nonatomic,strong) UIButton *graffitiButton;
|
||||
///惩罚礼物
|
||||
@property (nonatomic, strong) UIButton *punishButton;
|
||||
///新标识图标
|
||||
@property (nonatomic, strong) UIImageView *freshIconImage;
|
||||
///个播礼物
|
||||
@property (nonatomic,strong) UIButton *anchorButton;
|
||||
///背包总价值
|
||||
@@ -65,6 +69,8 @@
|
||||
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftGraffitiArray;
|
||||
///个播礼物数据源
|
||||
@property (nonatomic,strong) NSArray<GiftInfoModel *> *anchorArray;
|
||||
///惩罚礼物数据源
|
||||
@property (nonatomic, strong) NSArray<GiftInfoModel *> *punishArray;
|
||||
///总的价值
|
||||
@property (nonatomic,strong) NSAttributedString *totalAttribute;
|
||||
///当前展示的数据的类型
|
||||
@@ -98,6 +104,7 @@
|
||||
self.weekStarButton.selected = NO;
|
||||
self.graffitiButton.selected = NO;
|
||||
self.anchorButton.selected = NO;
|
||||
self.punishButton.selected = NO;
|
||||
sender.selected = !sender.selected;
|
||||
self.segmentType = sender.tag;
|
||||
}
|
||||
@@ -115,11 +122,14 @@
|
||||
- (void)giftHeadTypeHadChange:(NSInteger)headType {
|
||||
if (headType == 1) {
|
||||
[self.graffitiButton removeFromSuperview];
|
||||
[self.punishButton removeFromSuperview];
|
||||
[self.freshIconImage removeFromSuperview];
|
||||
[self.segmentStackView addArrangedSubview:self.normalGiftButton];
|
||||
[self.segmentStackView addArrangedSubview:self.nobleGiftButton];
|
||||
[self.segmentStackView addArrangedSubview:self.luckyGiftButton];
|
||||
[self.segmentStackView addArrangedSubview:self.weekStarButton];
|
||||
if(self.roomType == RoomType_Anchor) {
|
||||
[self.segmentStackView addArrangedSubview:self.anchorButton];
|
||||
[self didClickGiftSegmentAction:self.anchorButton];
|
||||
}
|
||||
if(self.segmentType != GiftSegmentType_Pack) {
|
||||
@@ -132,6 +142,13 @@
|
||||
[self.weekStarButton removeFromSuperview];
|
||||
[self.anchorButton removeFromSuperview];
|
||||
[self.segmentStackView addArrangedSubview:self.graffitiButton];
|
||||
[self.segmentStackView addArrangedSubview:self.punishButton];
|
||||
[self addSubview:self.freshIconImage];
|
||||
[self.freshIconImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.punishButton.mas_right).mas_offset(-5);
|
||||
make.bottom.mas_equalTo(self.punishButton.mas_top).mas_offset(5);
|
||||
make.size.mas_equalTo(CGSizeMake(24, 10));
|
||||
}];
|
||||
if(self.segmentType != GiftSegmentType_Pack) {
|
||||
[self didClickGiftSegmentAction:self.graffitiButton];
|
||||
}
|
||||
@@ -360,6 +377,7 @@
|
||||
[self resetSelectGift:self.giftWeekStarArray];
|
||||
[self resetSelectGift:self.giftGraffitiArray];
|
||||
[self resetSelectGift:self.anchorArray];
|
||||
[self resetSelectGift:self.punishArray];
|
||||
self.totalValueLabel.hidden = YES;
|
||||
switch (_segmentType) {
|
||||
case GiftSegmentType_Normal:
|
||||
@@ -389,6 +407,12 @@
|
||||
case GiftSegmentType_Anchor:
|
||||
[self.datasource addObjectsFromArray:self.anchorArray];
|
||||
break;
|
||||
case GiftSegmentType_Punish:
|
||||
{
|
||||
[self.datasource addObjectsFromArray:self.punishArray];
|
||||
[self.freshIconImage removeFromSuperview];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
[self.datasource addObjectsFromArray:self.giftArray];
|
||||
break;
|
||||
@@ -444,6 +468,7 @@
|
||||
NSMutableArray * weekStarArray = [NSMutableArray array];
|
||||
NSMutableArray * graffiti = [NSMutableArray array];
|
||||
NSMutableArray * anchor = [NSMutableArray array];
|
||||
NSMutableArray * punishArray = [NSMutableArray array];
|
||||
[_normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.giftType == GiftType_Lucky) {
|
||||
[luckyArray addObject:obj];
|
||||
@@ -457,6 +482,8 @@
|
||||
[graffiti addObject:obj];
|
||||
}else if (obj.giftType == GiftType_Anchor) {
|
||||
[anchor addObject:obj];
|
||||
} else if (obj.giftType == GiftType_Punish) {
|
||||
[punishArray addObject:obj];
|
||||
}
|
||||
}];
|
||||
self.giftArray = normaleArray;
|
||||
@@ -465,6 +492,7 @@
|
||||
self.giftWeekStarArray = weekStarArray;
|
||||
self.giftGraffitiArray = graffiti;
|
||||
self.anchorArray = anchor;
|
||||
self.punishArray = punishArray;
|
||||
if (self.defaultSelectGiftId.length) {
|
||||
for (GiftInfoModel *gift in self.normalOriginArray) {
|
||||
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
|
||||
@@ -504,6 +532,12 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (GiftInfoModel *gift in self.punishArray) {
|
||||
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
|
||||
self.segmentType = GiftSegmentType_Punish;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self.segmentType = GiftSegmentType_Normal;
|
||||
}
|
||||
@@ -525,6 +559,7 @@
|
||||
self.luckyGiftButton.hidden = YES;
|
||||
self.graffitiButton.hidden = YES;
|
||||
self.anchorButton.hidden = YES;
|
||||
self.punishButton.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,6 +674,28 @@
|
||||
return _graffitiButton;
|
||||
}
|
||||
|
||||
- (UIButton *)punishButton {
|
||||
if (!_punishButton) {
|
||||
_punishButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_punishButton setTitle:@"惩罚礼物" forState:UIControlStateNormal];
|
||||
[_punishButton setTitleColor:[ThemeColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
|
||||
[_punishButton setTitleColor:[ThemeColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
|
||||
_punishButton.titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightSemibold];
|
||||
_punishButton.tag = GiftSegmentType_Punish;
|
||||
_punishButton.selected = NO;
|
||||
[_punishButton addTarget:self action:@selector(didClickGiftSegmentAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _punishButton;
|
||||
}
|
||||
|
||||
- (UIImageView *)freshIconImage {
|
||||
if (!_freshIconImage) {
|
||||
_freshIconImage = [[UIImageView alloc] init];
|
||||
_freshIconImage.image = [UIImage imageNamed:@"gift_type_newIcon"];
|
||||
}
|
||||
return _freshIconImage;
|
||||
}
|
||||
|
||||
- (UIButton *)anchorButton {
|
||||
if (!_anchorButton) {
|
||||
_anchorButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
|
Reference in New Issue
Block a user