涂鸦礼物

This commit is contained in:
fengshuo
2022-08-22 20:07:36 +08:00
parent 96a1eb2cb0
commit fb823c0147
18 changed files with 483 additions and 4 deletions

View File

@@ -626,6 +626,7 @@
E88C72A02828FCD40047FB2B /* XPMusicLibraryPlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C729F2828FCD40047FB2B /* XPMusicLibraryPlayView.m */; }; E88C72A02828FCD40047FB2B /* XPMusicLibraryPlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C729F2828FCD40047FB2B /* XPMusicLibraryPlayView.m */; };
E88C72A3282917590047FB2B /* XPRoomMusicVoiceSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C72A2282917590047FB2B /* XPRoomMusicVoiceSettingView.m */; }; E88C72A3282917590047FB2B /* XPRoomMusicVoiceSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C72A2282917590047FB2B /* XPRoomMusicVoiceSettingView.m */; };
E88C72A6282921D60047FB2B /* XPRoomBackMusicPlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C72A5282921D60047FB2B /* XPRoomBackMusicPlayerView.m */; }; E88C72A6282921D60047FB2B /* XPRoomBackMusicPlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88C72A5282921D60047FB2B /* XPRoomBackMusicPlayerView.m */; };
E8901CF628B38D89001E9A92 /* XPGraffitiGiftView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8901CF528B38D89001E9A92 /* XPGraffitiGiftView.m */; };
E890BC04273CF0500007C46B /* XPGiftCountModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC03273CF0500007C46B /* XPGiftCountModel.m */; }; E890BC04273CF0500007C46B /* XPGiftCountModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC03273CF0500007C46B /* XPGiftCountModel.m */; };
E890BC07273CF1800007C46B /* XPGiftCountCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC06273CF1800007C46B /* XPGiftCountCollectionViewCell.m */; }; E890BC07273CF1800007C46B /* XPGiftCountCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC06273CF1800007C46B /* XPGiftCountCollectionViewCell.m */; };
E890BC0D273D09A50007C46B /* XPGiftCountView.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC0C273D09A50007C46B /* XPGiftCountView.m */; }; E890BC0D273D09A50007C46B /* XPGiftCountView.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC0C273D09A50007C46B /* XPGiftCountView.m */; };
@@ -2188,6 +2189,8 @@
E88C72A2282917590047FB2B /* XPRoomMusicVoiceSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMusicVoiceSettingView.m; sourceTree = "<group>"; }; E88C72A2282917590047FB2B /* XPRoomMusicVoiceSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMusicVoiceSettingView.m; sourceTree = "<group>"; };
E88C72A4282921D60047FB2B /* XPRoomBackMusicPlayerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomBackMusicPlayerView.h; sourceTree = "<group>"; }; E88C72A4282921D60047FB2B /* XPRoomBackMusicPlayerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomBackMusicPlayerView.h; sourceTree = "<group>"; };
E88C72A5282921D60047FB2B /* XPRoomBackMusicPlayerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomBackMusicPlayerView.m; sourceTree = "<group>"; }; E88C72A5282921D60047FB2B /* XPRoomBackMusicPlayerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomBackMusicPlayerView.m; sourceTree = "<group>"; };
E8901CF428B38D89001E9A92 /* XPGraffitiGiftView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGraffitiGiftView.h; sourceTree = "<group>"; };
E8901CF528B38D89001E9A92 /* XPGraffitiGiftView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGraffitiGiftView.m; sourceTree = "<group>"; };
E890BC02273CF0500007C46B /* XPGiftCountModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCountModel.h; sourceTree = "<group>"; }; E890BC02273CF0500007C46B /* XPGiftCountModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCountModel.h; sourceTree = "<group>"; };
E890BC03273CF0500007C46B /* XPGiftCountModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftCountModel.m; sourceTree = "<group>"; }; E890BC03273CF0500007C46B /* XPGiftCountModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftCountModel.m; sourceTree = "<group>"; };
E890BC05273CF1800007C46B /* XPGiftCountCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCountCollectionViewCell.h; sourceTree = "<group>"; }; E890BC05273CF1800007C46B /* XPGiftCountCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCountCollectionViewCell.h; sourceTree = "<group>"; };
@@ -5549,6 +5552,8 @@
E890BC0C273D09A50007C46B /* XPGiftCountView.m */, E890BC0C273D09A50007C46B /* XPGiftCountView.m */,
9B41D36F28264E320048C588 /* XPWeekStarInfoView.h */, 9B41D36F28264E320048C588 /* XPWeekStarInfoView.h */,
9B41D37028264E320048C588 /* XPWeekStarInfoView.m */, 9B41D37028264E320048C588 /* XPWeekStarInfoView.m */,
E8901CF428B38D89001E9A92 /* XPGraffitiGiftView.h */,
E8901CF528B38D89001E9A92 /* XPGraffitiGiftView.m */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -8205,6 +8210,7 @@
E8F1559028125E2D00EE8C06 /* MessageAudioCenter.m in Sources */, E8F1559028125E2D00EE8C06 /* MessageAudioCenter.m in Sources */,
9B9DFD9A27DB2194000F95B3 /* XPSessionMessageHeadView.m in Sources */, 9B9DFD9A27DB2194000F95B3 /* XPSessionMessageHeadView.m in Sources */,
18C17A5D26F338F300C48E11 /* XplanFBFlutterViewContainer.m in Sources */, 18C17A5D26F338F300C48E11 /* XplanFBFlutterViewContainer.m in Sources */,
E8901CF628B38D89001E9A92 /* XPGraffitiGiftView.m in Sources */,
E89DA67527009ACD008483C1 /* XPMineRechargeNavView.m in Sources */, E89DA67527009ACD008483C1 /* XPMineRechargeNavView.m in Sources */,
E8C1672A2806B1E500ECB15C /* XPGuildSuperAdminSetTableViewCell.m in Sources */, E8C1672A2806B1E500ECB15C /* XPGuildSuperAdminSetTableViewCell.m in Sources */,
E8834E4528003A8F0029CCC1 /* XPMineMangerListViewController.m in Sources */, E8834E4528003A8F0029CCC1 /* XPMineMangerListViewController.m in Sources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_gift_graffiti_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_gift_graffiti_close@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_gift_graffiti_delete@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_gift_graffiti_delete@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_gift_graffiti_hand@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_gift_graffiti_hand@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_gift_graffiti_repeal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_gift_graffiti_repeal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 889 B

View File

@@ -15,6 +15,7 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
GiftSegmentType_Noble,///贵族礼物 GiftSegmentType_Noble,///贵族礼物
GiftSegmentType_WeekStar, ///周星礼物 GiftSegmentType_WeekStar, ///周星礼物
GiftSegmentType_Pack,///背包礼物 GiftSegmentType_Pack,///背包礼物
GiftSegmentType_Graffiti,///涂鸦礼物
}; };
@@ -28,6 +29,9 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
///点击了切换不同礼物的tabbar ///点击了切换不同礼物的tabbar
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickSegment:(GiftSegmentType)type; - (void)xPGiftInfoView:(XPGiftInfoView *)view didClickSegment:(GiftSegmentType)type;
///点击了某个item
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickItem:(GiftInfoModel *)info type:(GiftSegmentType)type;
///点击了贵族特权 ///点击了贵族特权
- (void)xPGiftInfoViewDidClickNobleEntrance:(XPGiftInfoView *)view; - (void)xPGiftInfoViewDidClickNobleEntrance:(XPGiftInfoView *)view;

View File

@@ -39,6 +39,8 @@
@property (nonatomic,strong) UIView * segmentPlaceView; @property (nonatomic,strong) UIView * segmentPlaceView;
/// ///
@property (nonatomic,strong) UIButton *playRuleButton; @property (nonatomic,strong) UIButton *playRuleButton;
///
@property (nonatomic,strong) UIButton *graffitiButton;
/// ///
@property (nonatomic,strong) UILabel *totalValueLabel; @property (nonatomic,strong) UILabel *totalValueLabel;
/// ///
@@ -63,6 +65,8 @@
@property (nonatomic, strong) NSArray<GiftInfoModel *> *giftWeekStarArray; @property (nonatomic, strong) NSArray<GiftInfoModel *> *giftWeekStarArray;
///// /////
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftPackArray; @property (nonatomic,strong) NSArray<GiftInfoModel *> *giftPackArray;
///
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftGraffitiArray;
/// ///
@property (nonatomic,strong) NSAttributedString *totalAttribute; @property (nonatomic,strong) NSAttributedString *totalAttribute;
/// ///
@@ -92,6 +96,7 @@
self.nobleGiftButton.selected = NO; self.nobleGiftButton.selected = NO;
self.packGiftButton.selected = NO; self.packGiftButton.selected = NO;
self.weekStarButton.selected = NO; self.weekStarButton.selected = NO;
self.graffitiButton.selected = NO;
sender.selected = !sender.selected; sender.selected = !sender.selected;
self.segmentType = sender.tag; self.segmentType = sender.tag;
} }
@@ -134,6 +139,7 @@
[self.segmentStackView addArrangedSubview:self.nobleGiftButton]; [self.segmentStackView addArrangedSubview:self.nobleGiftButton];
[self.segmentStackView addArrangedSubview:self.weekStarButton]; [self.segmentStackView addArrangedSubview:self.weekStarButton];
[self.segmentStackView addArrangedSubview:self.packGiftButton]; [self.segmentStackView addArrangedSubview:self.packGiftButton];
[self.segmentStackView addArrangedSubview:self.graffitiButton];
[self.segmentStackView addArrangedSubview:self.segmentPlaceView]; [self.segmentStackView addArrangedSubview:self.segmentPlaceView];
[self.segmentStackView addArrangedSubview:self.playRuleButton]; [self.segmentStackView addArrangedSubview:self.playRuleButton];
[self.segmentStackView addArrangedSubview:self.totalValueLabel]; [self.segmentStackView addArrangedSubview:self.totalValueLabel];
@@ -294,6 +300,9 @@
GiftInfoModel * giftInfo= [self.datasource objectAtIndex:indexPath.item]; GiftInfoModel * giftInfo= [self.datasource objectAtIndex:indexPath.item];
[self dealSelectGift:giftInfo]; [self dealSelectGift:giftInfo];
[self.giftcollectionView reloadData]; [self.giftcollectionView reloadData];
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftInfoView:didClickItem:type:)]) {
[self.delegate xPGiftInfoView:self didClickItem:giftInfo type:self.segmentType];
}
} }
} }
@@ -321,6 +330,7 @@
[self resetSelectGift:self.giftLuckyArray]; [self resetSelectGift:self.giftLuckyArray];
[self resetSelectGift:self.giftNobleArray]; [self resetSelectGift:self.giftNobleArray];
[self resetSelectGift:self.giftWeekStarArray]; [self resetSelectGift:self.giftWeekStarArray];
[self resetSelectGift:self.giftGraffitiArray];
self.totalValueLabel.hidden = YES; self.totalValueLabel.hidden = YES;
self.nobleButton.hidden = YES; self.nobleButton.hidden = YES;
self.weekStarView.hidden = YES; self.weekStarView.hidden = YES;
@@ -348,6 +358,9 @@
self.totalValueLabel.attributedText= self.totalAttribute; self.totalValueLabel.attributedText= self.totalAttribute;
} }
break; break;
case GiftSegmentType_Graffiti:
[self.datasource addObjectsFromArray:self.giftGraffitiArray];
break;
default: default:
[self.datasource addObjectsFromArray:self.giftArray]; [self.datasource addObjectsFromArray:self.giftArray];
break; break;
@@ -404,6 +417,7 @@
self.giftLuckyArray = luckyArray; self.giftLuckyArray = luckyArray;
self.giftNobleArray = nobleArray; self.giftNobleArray = nobleArray;
self.giftWeekStarArray = weekStarArray; self.giftWeekStarArray = weekStarArray;
self.giftGraffitiArray = luckyArray;
if (self.defaultSelectGiftId.length) { if (self.defaultSelectGiftId.length) {
for (GiftInfoModel *gift in self.normalOriginArray) { for (GiftInfoModel *gift in self.normalOriginArray) {
if (gift.giftId == [self.defaultSelectGiftId integerValue]) { if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
@@ -429,6 +443,13 @@
break; break;
} }
} }
for (GiftInfoModel *gift in self.giftGraffitiArray) {
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
self.segmentType = GiftSegmentType_Graffiti;
break;
}
}
} else { } else {
self.segmentType = GiftSegmentType_Normal; self.segmentType = GiftSegmentType_Normal;
} }
@@ -548,6 +569,20 @@
return _packGiftButton; return _packGiftButton;
} }
- (UIButton *)graffitiButton {
if (!_graffitiButton) {
_graffitiButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_graffitiButton setTitle:@"涂鸦礼物" forState:UIControlStateNormal];
[_graffitiButton setTitleColor:[ThemeColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
[_graffitiButton setTitleColor:[ThemeColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
_graffitiButton.titleLabel.font = [UIFont systemFontOfSize:14];
_graffitiButton.tag = GiftSegmentType_Graffiti;
_graffitiButton.selected = NO;
[_graffitiButton addTarget:self action:@selector(didClickGiftSegmentAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _graffitiButton;
}
- (UIButton *)nobleButton { - (UIButton *)nobleButton {
if (!_nobleButton) { if (!_nobleButton) {
_nobleButton = [UIButton buttonWithType:UIButtonTypeCustom]; _nobleButton = [UIButton buttonWithType:UIButtonTypeCustom];

View File

@@ -0,0 +1,16 @@
//
// XPGraffitiGiftView.h
// xplan-ios
//
// Created by 冯硕 on 2022/8/22.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPGraffitiGiftView : UIView
@property (nonatomic,strong) UIImage *image;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,307 @@
//
// XPGraffitiGiftView.m
// xplan-ios
//
// Created by on 2022/8/22.
//
#import "XPGraffitiGiftView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
@interface XPGraffitiGiftView ()
///
@property (nonatomic,strong) UIView * contentView;
///
@property (nonatomic,strong) UIStackView *tipsStackView;
///🏻
@property (nonatomic,strong) UIImageView *handImageView;
///
@property (nonatomic,strong) UILabel *tipsLabel;
///toolView
@property (nonatomic,strong) UIView * toolView;
///
@property (nonatomic,strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UIStackView *toolStackView;
///
@property (nonatomic,strong) UIButton *changeButton;
///
@property (nonatomic,strong) UIButton *repealButton;
///
@property (nonatomic,strong) UIButton *deleteButton;
///
@property (nonatomic,strong) UIButton *closeButton;
@property (nonatomic,assign) CGPoint panPoint;
///
@property (nonatomic,assign) CGPoint beginPoint;
///
@property (nonatomic,assign) CGFloat step;
///
@property (nonatomic,strong) NSMutableArray *datasource;
///
@property (nonatomic,assign) int index;
@end
@implementation XPGraffitiGiftView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.step = 20;
UIPanGestureRecognizer * panGes = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)];
[self addGestureRecognizer:panGes];
self.backgroundColor = [UIColor clearColor];
[self addSubview:self.contentView];
[self.contentView addSubview:self.tipsStackView];
[self.contentView addSubview:self.toolView];
[self.tipsStackView addArrangedSubview:self.handImageView];
[self.tipsStackView addArrangedSubview:self.tipsLabel];
[self.toolView addSubview:self.titleLabel];
[self.toolView addSubview:self.toolStackView];
[self.toolStackView addArrangedSubview:self.changeButton];
[self.toolStackView addArrangedSubview:self.repealButton];
[self.toolStackView addArrangedSubview:self.deleteButton];
[self.toolStackView addArrangedSubview:self.closeButton];
}
- (void)initSubViewConstraints {
CGFloat avatarHeight = (43 + 15 * 2);
CGFloat bottomHeight = (45);
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight - avatarHeight - bottomHeight);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.tipsStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.width.mas_equalTo(KScreenWidth);
}];
[self.handImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(78, 93));
}];
[self.toolView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.left.right.mas_equalTo(self.contentView);
make.height.mas_equalTo(56);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.toolView).offset(15);
make.centerY.mas_equalTo(self.toolView);
}];
[self.toolStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.toolView).offset(-15);
make.height.mas_equalTo(22);
make.centerY.mas_equalTo(self.toolView);
}];
[self.changeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(50);
}];
[self.repealButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(22);
}];
[self.deleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(22);
}];
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(22);
}];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
self.tipsStackView.hidden = YES;
UITouch *touch = touches.anyObject;
CGPoint point = [touch locationInView:self.contentView];
self.beginPoint = point;
NSLog(@"beginPoint:X:%.2f, Y:%.2f", point.x, point.y);
}
- (void)panAction:(UIPanGestureRecognizer *)tap {
CGPoint point = [tap translationInView:self.contentView];
NSLog(@"panAction:X:%.2f, Y:%.2f", point.x, point.y);
CGFloat dx = [self myAbs:point.x - self.panPoint.x];
CGFloat dy = [self myAbs:point.y - self.panPoint.y];
CGPoint drawPoint = CGPointMake(self.beginPoint.x + point.x , self.beginPoint.y + point.y);
if ((dx * dx + dy * dy) > 2 * self.step * self.step) {
[self addSubView:drawPoint];
self.panPoint = point;
}
}
- (int)myAbs:(int)num {
if (num >= 0) {
return num;
}
return -num;
}
- (void)addSubView:(CGPoint)point {
UIImageView * imageView = [[UIImageView alloc] init];
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.layer.masksToBounds = YES;
imageView.image = self.image;
imageView.frame = CGRectMake(point.x, point.y, 20, 20);
[self.contentView addSubview:imageView];
}
#pragma mark - Event Response
- (void)changeButtonAction:(UIButton *)sender {
}
- (void)repealButtonAction:(UIButton *)sender {
}
- (void)deleteButtonAction:(UIButton *)sender {
}
- (void)closeButtonAction:(UIButton *)sender {
}
#pragma mark - Getters And Setters
- (UIView *)contentView {
if (!_contentView) {
_contentView = [[UIView alloc] init];
_contentView.backgroundColor = UIColorRGBAlpha(0x000000, 0.7);
}
return _contentView;
}
- (UIStackView *)tipsStackView {
if (!_tipsStackView) {
_tipsStackView = [[UIStackView alloc] init];
_tipsStackView.axis = UILayoutConstraintAxisVertical;
_tipsStackView.distribution = UIStackViewDistributionFill;
_tipsStackView.alignment = UIStackViewAlignmentCenter;
_tipsStackView.spacing = 17;
}
return _tipsStackView;
}
- (UIImageView *)handImageView {
if (!_handImageView) {
_handImageView = [[UIImageView alloc] init];
_handImageView.userInteractionEnabled = YES;
_handImageView.image = [UIImage imageNamed:@"room_gift_graffiti_hand"];
}
return _handImageView;
}
- (UILabel *)tipsLabel {
if (!_tipsLabel) {
_tipsLabel = [[UILabel alloc] init];
_tipsLabel.font = [UIFont systemFontOfSize:14];
_tipsLabel.textColor = [ThemeColor textThirdColor];
_tipsLabel.text = @"滑动手指,绘制图形";
}
return _tipsLabel;
}
- (UIView *)toolView {
if (!_toolView) {
_toolView = [[UIView alloc] init];
_toolView.backgroundColor = UIColorRGBAlpha(0xFFFFFF, 0.2);
CAShapeLayer * layer = [CAShapeLayer layer];
layer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 56) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)].CGPath;
_toolView.layer.mask = layer;
}
return _toolView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:14];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.text = @"至少画10个才能送出";
}
return _titleLabel;
}
- (UIStackView *)toolStackView {
if (!_toolStackView) {
_toolStackView = [[UIStackView alloc] init];
_toolStackView.axis = UILayoutConstraintAxisHorizontal;
_toolStackView.distribution = UIStackViewDistributionFill;
_toolStackView.alignment = UIStackViewAlignmentCenter;
_toolStackView.spacing = 12;
}
return _toolStackView;
}
- (UIButton *)changeButton {
if (!_changeButton) {
_changeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_changeButton setTitle:@"切换涂鸦" forState:UIControlStateNormal];
[_changeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_changeButton.titleLabel.font = [UIFont systemFontOfSize:12];
[_changeButton addTarget:self action:@selector(changeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _changeButton;
}
- (UIButton *)repealButton {
if (!_repealButton) {
_repealButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_repealButton setImage:[UIImage imageNamed:@"room_gift_graffiti_repeal"] forState:UIControlStateNormal];
[_repealButton setImage:[UIImage imageNamed:@"room_gift_graffiti_repeal"] forState:UIControlStateSelected];
[_repealButton addTarget:self action:@selector(repealButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _repealButton;
}
- (UIButton *)deleteButton {
if (!_deleteButton) {
_deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_deleteButton setImage:[UIImage imageNamed:@"room_gift_graffiti_delete"] forState:UIControlStateNormal];
[_deleteButton setImage:[UIImage imageNamed:@"room_gift_graffiti_delete"] forState:UIControlStateSelected];
[_deleteButton addTarget:self action:@selector(deleteButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _deleteButton;
}
- (UIButton *)closeButton {
if (!_closeButton) {
_closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_closeButton setImage:[UIImage imageNamed:@"room_gift_graffiti_close"] forState:UIControlStateNormal];
[_closeButton setImage:[UIImage imageNamed:@"room_gift_graffiti_close"] forState:UIControlStateSelected];
[_closeButton addTarget:self action:@selector(closeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _closeButton;
}
@end

View File

@@ -9,6 +9,7 @@
///Third ///Third
#import <Masonry/Masonry.h> #import <Masonry/Masonry.h>
#import <NIMSDK/NIMSDK.h> #import <NIMSDK/NIMSDK.h>
#import <UIImageView+WebCache.h>
///Tool ///Tool
#import "XPMacro.h" #import "XPMacro.h"
#import "XPGiftPresenter.h" #import "XPGiftPresenter.h"
@@ -30,6 +31,7 @@
#import "XPGiftInfoView.h" #import "XPGiftInfoView.h"
#import "XPGiftBarView.h" #import "XPGiftBarView.h"
#import "XPRoomHalfWebView.h" #import "XPRoomHalfWebView.h"
#import "XPGraffitiGiftView.h"
///P ///P
#import "XPGiftProtocol.h" #import "XPGiftProtocol.h"
///VC ///VC
@@ -53,6 +55,8 @@
@property (nonatomic,strong) XPGiftBarView *giftBarView; @property (nonatomic,strong) XPGiftBarView *giftBarView;
///View ///View
@property (nonatomic,strong) UIView * bottomView; @property (nonatomic,strong) UIView * bottomView;
///
@property (nonatomic,strong) XPGraffitiGiftView *graffitiView;
///uid/ uid ///uid/ uid
@property (nonatomic,copy) NSString *roomUid; @property (nonatomic,copy) NSString *roomUid;
///使 ///使
@@ -61,7 +65,6 @@
@property (nonatomic,assign) int normalGiftRetryCount; @property (nonatomic,assign) int normalGiftRetryCount;
/// ///
@property (nonatomic,assign) int packGiftRetryCount; @property (nonatomic,assign) int packGiftRetryCount;
///
@property (nonatomic,strong) NSArray<XPGiftUserInfoModel *> *userArray; @property (nonatomic,strong) NSArray<XPGiftUserInfoModel *> *userArray;
@end @end
@@ -71,9 +74,6 @@
return [[XPGiftPresenter alloc] init]; return [[XPGiftPresenter alloc] init];
} }
- (void)dealloc {
NSLog(@"六面板销毁了");
}
- (instancetype)initWithType:(SendGiftType)type uid:(NSString * __nullable)uid{ - (instancetype)initWithType:(SendGiftType)type uid:(NSString * __nullable)uid{
if (self = [super init]) { if (self = [super init]) {
@@ -95,6 +95,7 @@
[self.view addSubview:self.topView]; [self.view addSubview:self.topView];
[self.view addSubview:self.contentView]; [self.view addSubview:self.contentView];
[self.contentView addSubview:self.stackView]; [self.contentView addSubview:self.stackView];
[self.stackView addArrangedSubview:self.graffitiView];
[self.stackView addArrangedSubview:self.userView]; [self.stackView addArrangedSubview:self.userView];
[self.stackView addArrangedSubview:self.giftInfoView]; [self.stackView addArrangedSubview:self.giftInfoView];
[self.stackView addArrangedSubview:self.giftBarView]; [self.stackView addArrangedSubview:self.giftBarView];
@@ -398,6 +399,20 @@
[self.delegate.getCurrentNav pushViewController:webVC animated:YES]; [self.delegate.getCurrentNav pushViewController:webVC animated:YES];
} }
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickItem:(GiftInfoModel *)info type:(GiftSegmentType)type {
if (type == GiftSegmentType_Graffiti) {
self.giftInfoView.hidden = YES;
self.graffitiView.hidden = NO;
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:info.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
if (error == nil && image) {
self.graffitiView.image = image;
} else {
self.giftInfoView.hidden = NO;
}
}];
}
}
#pragma mark - XPGiftProtocol #pragma mark - XPGiftProtocol
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo { - (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
self.giftBarView.isShowFirstRecharge = userInfo.isFirstCharge; self.giftBarView.isShowFirstRecharge = userInfo.isFirstCharge;
@@ -554,4 +569,12 @@
return _bottomView; return _bottomView;
} }
- (XPGraffitiGiftView *)graffitiView {
if (!_graffitiView) {
_graffitiView = [[XPGraffitiGiftView alloc] init];
_graffitiView.hidden = YES;
}
return _graffitiView;
}
@end @end