97 lines
2.2 KiB
Mathematica
97 lines
2.2 KiB
Mathematica
![]() |
//
|
||
|
// XPSendGiftView.m
|
||
|
// xplan-ios
|
||
|
//
|
||
|
// Created by 冯硕 on 2021/11/9.
|
||
|
//
|
||
|
|
||
|
#import "XPSendGiftView.h"
|
||
|
///Third
|
||
|
#import <Masonry/Masonry.h>
|
||
|
///Tool
|
||
|
#import "XPMacro.h"
|
||
|
#import "ThemeColor+SendGift.h"
|
||
|
///View
|
||
|
#import "XPGiftUsersView.h"
|
||
|
#import "XPGiftInfoView.h"
|
||
|
#import "XPGiftBarView.h"
|
||
|
|
||
|
|
||
|
@interface XPSendGiftView ()
|
||
|
///
|
||
|
@property (nonatomic,strong) UIStackView *stackView;
|
||
|
///送礼物的人
|
||
|
@property (nonatomic,strong) XPGiftUsersView *userView;
|
||
|
///送的什么礼物
|
||
|
@property (nonatomic,strong) XPGiftInfoView *giftInfoView;
|
||
|
///送多少礼物
|
||
|
@property (nonatomic,strong) XPGiftBarView *giftBarView;
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation XPSendGiftView
|
||
|
|
||
|
- (instancetype)initWithType:(SendGiftType)type uid:(NSString *)uid {
|
||
|
if (self = [super init]) {
|
||
|
[self initSubViews];
|
||
|
[self initSubViewConstraints];
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
#pragma mark - Private Method
|
||
|
- (void)initSubViews {
|
||
|
self.backgroundColor = [ThemeColor giftBackGroundColor];
|
||
|
[self addSubview:self.stackView];
|
||
|
[self.stackView addArrangedSubview:self.userView];
|
||
|
[self.stackView addArrangedSubview:self.giftInfoView];
|
||
|
[self.stackView addArrangedSubview:self.giftBarView];
|
||
|
}
|
||
|
|
||
|
- (void)initSubViewConstraints {
|
||
|
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.width.mas_equalTo(KScreenWidth);
|
||
|
make.bottom.mas_equalTo(self.stackView.mas_bottom);
|
||
|
}];
|
||
|
|
||
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.right.top.mas_equalTo(self);
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
#pragma mark - Getters And Setters
|
||
|
- (XPGiftUsersView *)userView {
|
||
|
if (!_userView) {
|
||
|
_userView = [[XPGiftUsersView alloc] initWithType:SendGiftType_Room];
|
||
|
}
|
||
|
return _userView;
|
||
|
}
|
||
|
|
||
|
- (XPGiftInfoView *)giftInfoView {
|
||
|
if (!_giftInfoView) {
|
||
|
_giftInfoView = [[XPGiftInfoView alloc] init];
|
||
|
}
|
||
|
return _giftInfoView;
|
||
|
}
|
||
|
|
||
|
- (XPGiftBarView *)giftBarView {
|
||
|
if (!_giftBarView) {
|
||
|
_giftBarView = [[XPGiftBarView alloc] init];
|
||
|
}
|
||
|
return _giftBarView;
|
||
|
}
|
||
|
|
||
|
- (UIStackView *)stackView {
|
||
|
if (!_stackView) {
|
||
|
_stackView = [[UIStackView alloc] init];
|
||
|
_stackView.axis = UILayoutConstraintAxisVertical;
|
||
|
_stackView.distribution = UIStackViewDistributionFill;
|
||
|
_stackView.alignment = UIStackViewAlignmentFill;
|
||
|
_stackView.spacing = 0;
|
||
|
_stackView.backgroundColor = [UIColor clearColor];
|
||
|
}
|
||
|
return _stackView;
|
||
|
}
|
||
|
|
||
|
@end
|