|
|
|
@@ -11,6 +11,8 @@
|
|
|
|
|
#import <JXPagingView/JXPagerListRefreshView.h>
|
|
|
|
|
#import <JXCategoryView/JXCategoryView.h>
|
|
|
|
|
#import "PIRoomSendRedPacketItemVC.h"
|
|
|
|
|
#import "XPRoomRedPacketPresenter.h"
|
|
|
|
|
#import "WalletInfoModel.h"
|
|
|
|
|
@interface PIRoomSendRedPacketVC ()<JXPagerViewDelegate,JXPagerMainTableViewGestureDelegate,JXCategoryViewDelegate,JXPagerMainTableViewGestureDelegate>
|
|
|
|
|
///host代理
|
|
|
|
|
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
|
|
|
|
@@ -20,15 +22,28 @@
|
|
|
|
|
@property (nonatomic, strong) JXCategoryTitleView *titleView;
|
|
|
|
|
///分页lineView
|
|
|
|
|
@property (nonatomic, strong) JXPagerView *contentView;
|
|
|
|
|
///返回
|
|
|
|
|
@property(nonatomic,strong) UIButton *pi_backBtn;
|
|
|
|
|
///背景
|
|
|
|
|
@property(nonatomic,strong) UIView *bgView;
|
|
|
|
|
///背景图片
|
|
|
|
|
@property(nonatomic,strong) UIImageView *topImageView;
|
|
|
|
|
///红包提示
|
|
|
|
|
@property(nonatomic,strong) UIButton *tipsBtn;
|
|
|
|
|
///钻石背景
|
|
|
|
|
@property(nonatomic,strong) UIImageView *diamondNumView;
|
|
|
|
|
///钻石数量
|
|
|
|
|
@property(nonatomic,strong) UILabel *diamondNumTextView;
|
|
|
|
|
///钻石icom
|
|
|
|
|
@property(nonatomic,strong) UIImageView *diamondIconView;
|
|
|
|
|
//加号
|
|
|
|
|
@property(nonatomic,strong) UIImageView *addIconView;
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation PIRoomSendRedPacketVC
|
|
|
|
|
- (XPRoomRedPacketPresenter *)createPresenter {
|
|
|
|
|
return [[XPRoomRedPacketPresenter alloc] init];
|
|
|
|
|
}
|
|
|
|
|
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
|
|
|
|
if (self = [super init]) {
|
|
|
|
|
self.hostDelegate = delegate;
|
|
|
|
@@ -38,6 +53,10 @@
|
|
|
|
|
- (BOOL)isHiddenNavBar {
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
|
|
|
[super viewWillAppear:animated];
|
|
|
|
|
[self.presenter getUserWalletInfo];
|
|
|
|
|
}
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
|
[super viewDidLoad];
|
|
|
|
|
self.view.backgroundColor = [UIColor clearColor];
|
|
|
|
@@ -52,8 +71,9 @@
|
|
|
|
|
[self.view addSubview:self.topImageView];
|
|
|
|
|
[self.view addSubview:self.tipsBtn];
|
|
|
|
|
[self.view addSubview:self.diamondNumView];
|
|
|
|
|
[self.diamondNumView addSubview:self.diamondIconView];
|
|
|
|
|
[self.diamondNumView addSubview:self.diamondNumTextView];
|
|
|
|
|
|
|
|
|
|
[self.diamondNumView addSubview:self.addIconView];
|
|
|
|
|
[self.view addSubview:self.contentView];
|
|
|
|
|
}
|
|
|
|
|
-(void)installConstraints{
|
|
|
|
@@ -70,21 +90,32 @@
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(243));
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
[self.diamondNumView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.equalTo(self.bgView.mas_top).mas_offset(kGetScaleWidth(13));
|
|
|
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(0));
|
|
|
|
|
make.width.mas_equalTo(kGetScaleWidth(81));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(30));
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
[self.tipsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.width.height.mas_equalTo(kGetScaleWidth(24));
|
|
|
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(12));
|
|
|
|
|
make.top.equalTo(self.topImageView.mas_top).mas_offset(kGetScaleWidth(71));
|
|
|
|
|
}];
|
|
|
|
|
[self.diamondNumTextView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
[self.diamondNumView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.equalTo(self.bgView.mas_top).mas_offset(kGetScaleWidth(13));
|
|
|
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(0));
|
|
|
|
|
make.width.mas_greaterThanOrEqualTo(kGetScaleWidth(10));
|
|
|
|
|
make.height.mas_equalTo(kGetScaleWidth(30));
|
|
|
|
|
}];
|
|
|
|
|
[self.diamondIconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.width.height.mas_equalTo(kGetScaleWidth(20));
|
|
|
|
|
make.centerY.equalTo(self.diamondNumView);
|
|
|
|
|
make.leading.mas_equalTo(kGetScaleWidth(6));
|
|
|
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(5));
|
|
|
|
|
}];
|
|
|
|
|
[self.addIconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerY.equalTo(self.diamondNumView);
|
|
|
|
|
make.width.height.mas_equalTo(kGetScaleWidth(16));
|
|
|
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(6));
|
|
|
|
|
}];
|
|
|
|
|
[self.diamondNumTextView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerY.equalTo(self.diamondNumView);
|
|
|
|
|
make.leading.mas_equalTo(kGetScaleWidth(25));
|
|
|
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(23));
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
@@ -92,7 +123,10 @@
|
|
|
|
|
make.left.right.bottom.mas_equalTo(self.view);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///获取用户钱包信息成功
|
|
|
|
|
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
|
|
|
|
|
self.diamondNumTextView.text = balanceInfo.diamonds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - JXCategoryViewDelegate
|
|
|
|
|
- (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView {
|
|
|
|
@@ -145,6 +179,21 @@
|
|
|
|
|
-(void)hiddenViewAction{
|
|
|
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
}
|
|
|
|
|
-(NSTextAttachment *)getDiamondNumAtt:(NSString *)image{
|
|
|
|
|
NSTextAttachment * diamondAttachment = [[NSTextAttachment alloc] init];
|
|
|
|
|
UIImage *diamondIconImage = [UIImage imageNamed:image];;
|
|
|
|
|
diamondAttachment.bounds = CGRectMake(0, roundf(kFontMedium(13).capHeight - diamondIconImage.size.height)/2.f, diamondIconImage.size.width, diamondIconImage.size.height);
|
|
|
|
|
diamondAttachment.image = diamondIconImage;
|
|
|
|
|
return diamondAttachment;
|
|
|
|
|
}
|
|
|
|
|
- (UIImage*)resizableImage:(UIImage *)image {
|
|
|
|
|
//图片拉伸区域
|
|
|
|
|
CGFloat top = (image.size.height - 1) / 2;
|
|
|
|
|
CGFloat left = (image.size.width - 1) / 2;
|
|
|
|
|
CGFloat right = (image.size.width - 1) / 2;
|
|
|
|
|
CGFloat bottom = (image.size.height - 1) / 2;
|
|
|
|
|
return [image resizableImageWithCapInsets:UIEdgeInsetsMake(top, left, bottom, right) resizingMode:UIImageResizingModeStretch];
|
|
|
|
|
}
|
|
|
|
|
#pragma mark - 懒加载
|
|
|
|
|
- (UIView *)bgView{
|
|
|
|
|
if(!_bgView){
|
|
|
|
@@ -179,33 +228,31 @@
|
|
|
|
|
- (UIImageView *)diamondNumView{
|
|
|
|
|
if(!_diamondNumView){
|
|
|
|
|
_diamondNumView = [UIImageView new];
|
|
|
|
|
_diamondNumView.image = kImage(@"pi_red_packet_top_diamond_bg");
|
|
|
|
|
_diamondNumView.image = [self resizableImage:kImage(@"pi_red_packet_top_diamond_bg")];
|
|
|
|
|
}
|
|
|
|
|
return _diamondNumView;
|
|
|
|
|
}
|
|
|
|
|
- (UILabel *)diamondNumTextView{
|
|
|
|
|
if(!_diamondNumTextView){
|
|
|
|
|
_diamondNumTextView = [UILabel new];
|
|
|
|
|
NSMutableAttributedString *numAtt = [[NSMutableAttributedString alloc]initWithString:@"9999" attributes:@{NSFontAttributeName:kFontMedium(13),NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
|
|
|
|
NSTextAttachment * diamondAttachment = [[NSTextAttachment alloc] init];
|
|
|
|
|
UIImage *diamondIconImage = [UIImage imageNamed:@"pi_red_packet_top_diamond_icon"];;
|
|
|
|
|
diamondAttachment.bounds = CGRectMake(0, roundf(kFontMedium(13).capHeight - diamondIconImage.size.height)/2.f, diamondIconImage.size.width, diamondIconImage.size.height);
|
|
|
|
|
|
|
|
|
|
diamondAttachment.image = diamondIconImage;
|
|
|
|
|
NSAttributedString * diamondAtt = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)diamondAttachment];
|
|
|
|
|
[numAtt insertAttributedString:diamondAtt atIndex:0];
|
|
|
|
|
|
|
|
|
|
NSTextAttachment * addAttachment = [[NSTextAttachment alloc] init];
|
|
|
|
|
UIImage *addIconImage = [UIImage imageNamed:@"pi_red_packet_top_diamond_add"];;
|
|
|
|
|
addAttachment.bounds = CGRectMake(0, roundf(kFontMedium(13).capHeight - addIconImage.size.height)/2.f, addIconImage.size.width, addIconImage.size.height);
|
|
|
|
|
|
|
|
|
|
addAttachment.image = addIconImage;
|
|
|
|
|
NSAttributedString * addAtt = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)addAttachment];
|
|
|
|
|
[numAtt insertAttributedString:addAtt atIndex:numAtt.length];
|
|
|
|
|
_diamondNumTextView.attributedText = numAtt;
|
|
|
|
|
_diamondNumTextView = [UILabel labelInitWithText:@"0" font:kFontMedium(13) textColor:[UIColor whiteColor]];
|
|
|
|
|
_diamondNumTextView.textAlignment = NSTextAlignmentCenter;
|
|
|
|
|
}
|
|
|
|
|
return _diamondNumTextView;
|
|
|
|
|
}
|
|
|
|
|
- (UIImageView *)diamondIconView{
|
|
|
|
|
if(!_diamondIconView){
|
|
|
|
|
_diamondIconView = [UIImageView new];
|
|
|
|
|
_diamondIconView.image = kImage(@"pi_red_packet_top_diamond_icon");
|
|
|
|
|
}
|
|
|
|
|
return _diamondIconView;
|
|
|
|
|
}
|
|
|
|
|
-(UIImageView *)addIconView{
|
|
|
|
|
if(!_addIconView){
|
|
|
|
|
_addIconView = [UIImageView new];
|
|
|
|
|
_addIconView.image = kImage(@"pi_red_packet_top_diamond_add");
|
|
|
|
|
}
|
|
|
|
|
return _addIconView;
|
|
|
|
|
}
|
|
|
|
|
- (JXCategoryTitleView *)titleView {
|
|
|
|
|
if (!_titleView) {
|
|
|
|
|
_titleView = [[JXCategoryTitleView alloc] init];
|
|
|
|
|