红包UI
This commit is contained in:
@@ -6,28 +6,242 @@
|
||||
//
|
||||
|
||||
#import "PIRoomSendRedPacketItemVC.h"
|
||||
|
||||
@interface PIRoomSendRedPacketItemVC ()
|
||||
|
||||
#import "PIInputRedPacketView.h"
|
||||
#import "PIRedPacketChooseTypeView.h"
|
||||
#import "PIInputScrollingView.h"
|
||||
#import "PIInputEntireServerScrollingView.h"
|
||||
@interface PIRoomSendRedPacketItemVC ()<PIRedPacketChooseTypeViewDelegate>
|
||||
///紅包金額
|
||||
@property(nonatomic,strong) PIInputRedPacketView *pi_priceView;
|
||||
///紅包數量
|
||||
@property(nonatomic,strong) PIInputRedPacketView *pi_numView;
|
||||
///搶紅包條件
|
||||
@property(nonatomic,strong) PIRedPacketChooseTypeView *chooseTypeView;
|
||||
///立即生效
|
||||
@property(nonatomic,strong) UIButton *promptlyBtn;
|
||||
////限時生效
|
||||
@property(nonatomic,strong) UIButton *limitBtn;
|
||||
///發紅包
|
||||
@property(nonatomic,strong) UIButton *sendBtn;
|
||||
///提示
|
||||
@property(nonatomic,strong) UILabel *tipsView;
|
||||
///输入弹幕
|
||||
@property(nonatomic,strong) PIInputScrollingView *scrollingView;
|
||||
///全服输入
|
||||
@property(nonatomic,strong) PIInputEntireServerScrollingView *serverInputView;
|
||||
@property(nonatomic,assign) PIRoomSendRedPacketItemVCType type;
|
||||
@end
|
||||
|
||||
@implementation PIRoomSendRedPacketItemVC
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
-(instancetype)initWithType:(PIRoomSendRedPacketItemVCType)type{
|
||||
self = [super init];
|
||||
if(self){
|
||||
self.type = type;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
-(void)installUI{
|
||||
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
[self.view addSubview:self.pi_priceView];
|
||||
[self.view addSubview:self.pi_numView];
|
||||
|
||||
if(self.type == Room_Send_Red_Packet_Type_Lobby){
|
||||
[self.view addSubview:self.chooseTypeView];
|
||||
[self.view addSubview:self.promptlyBtn];
|
||||
[self.view addSubview:self.limitBtn];
|
||||
[self.view addSubview:self.scrollingView];
|
||||
}else{
|
||||
[self.view addSubview:self.serverInputView];
|
||||
}
|
||||
[self.view addSubview:self.sendBtn];
|
||||
[self.view addSubview:self.tipsView];
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.pi_priceView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(10));
|
||||
make.width.mas_equalTo(kGetScaleWidth(327));
|
||||
make.height.mas_equalTo(kGetScaleWidth(48));
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
[self.pi_numView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(kGetScaleWidth(327));
|
||||
make.height.mas_equalTo(kGetScaleWidth(48));
|
||||
make.centerX.equalTo(self.view);
|
||||
make.top.equalTo(self.pi_priceView.mas_bottom).mas_offset(kGetScaleWidth(12));
|
||||
}];
|
||||
if(self.type == Room_Send_Red_Packet_Type_Lobby){
|
||||
[self.chooseTypeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.pi_numView.mas_bottom).mas_offset(kGetScaleWidth(16));
|
||||
make.leading.trailing.equalTo(self.view).inset(kGetScaleWidth(0));
|
||||
make.height.mas_equalTo(kGetScaleWidth(92));
|
||||
}];
|
||||
[self.promptlyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.chooseTypeView.mas_bottom).mas_offset(kGetScaleWidth(12));
|
||||
make.leading.mas_equalTo(kGetScaleWidth(24));
|
||||
make.width.mas_equalTo(kGetScaleWidth(154));
|
||||
make.height.mas_equalTo(kGetScaleWidth(52));
|
||||
}];
|
||||
[self.limitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.chooseTypeView.mas_bottom).mas_offset(kGetScaleWidth(12));
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(24));
|
||||
make.width.mas_equalTo(kGetScaleWidth(154));
|
||||
make.height.mas_equalTo(kGetScaleWidth(52));
|
||||
}];
|
||||
[self.scrollingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.chooseTypeView.mas_bottom).mas_offset(kGetScaleWidth(12));
|
||||
make.width.mas_equalTo(kGetScaleWidth(327));
|
||||
make.height.mas_equalTo(kGetScaleWidth(52));
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
[self.sendBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.pi_numView.mas_bottom).mas_offset(kGetScaleWidth(200));
|
||||
make.width.mas_equalTo(kGetScaleWidth(295));
|
||||
make.height.mas_equalTo(kGetScaleWidth(52));
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
}else{
|
||||
[self.serverInputView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.pi_numView.mas_bottom).mas_offset(kGetScaleWidth(24));
|
||||
make.width.mas_equalTo(kGetScaleWidth(327));
|
||||
make.height.mas_equalTo(kGetScaleWidth(76));
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
[self.sendBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.pi_numView.mas_bottom).mas_offset(kGetScaleWidth(128));
|
||||
make.width.mas_equalTo(kGetScaleWidth(295));
|
||||
make.height.mas_equalTo(kGetScaleWidth(52));
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
[self.tipsView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.sendBtn.mas_bottom).mas_offset(kGetScaleWidth(10));
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
#pragma mark - JXCategoryListContentViewDelegate
|
||||
#pragma mark - JXPagingViewListViewDelegate
|
||||
- (UIScrollView *)listScrollView {
|
||||
return self.chooseTypeView.collectionView;
|
||||
}
|
||||
|
||||
- (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
|
||||
self.scrollCallback = callback;
|
||||
}
|
||||
|
||||
- (UIView *)listView {
|
||||
return self.view;
|
||||
}
|
||||
#pragma mark- PIRedPacketChooseTypeViewDelegate
|
||||
- (void)chooseRedPacketType:(PIRedPacketChooseTypeViewType)type{
|
||||
switch (type) {
|
||||
case Red_Packet_Choose_type_Normal:
|
||||
{
|
||||
self.scrollingView.hidden = YES;
|
||||
self.promptlyBtn.hidden = NO;
|
||||
self.limitBtn.hidden = NO;
|
||||
}
|
||||
break;
|
||||
case Red_Packet_Choose_type_Scrolling:
|
||||
{
|
||||
self.scrollingView.hidden = NO;
|
||||
self.promptlyBtn.hidden = YES;
|
||||
self.limitBtn.hidden = YES;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
|
||||
- (PIInputRedPacketView *)pi_priceView{
|
||||
if(!_pi_priceView){
|
||||
_pi_priceView = [[PIInputRedPacketView alloc]initWithFrame:CGRectZero];
|
||||
_pi_priceView.isHiddenIcon = NO;
|
||||
_pi_priceView.pi_title = YMLocalizedString(@"PIRoomSendRedPacketItemVC0");
|
||||
_pi_priceView.unitTitle = YMLocalizedString(@"PIRoomSendRedPacketItemVC2");
|
||||
}
|
||||
return _pi_priceView;
|
||||
}
|
||||
- (PIInputRedPacketView *)pi_numView{
|
||||
if(!_pi_numView){
|
||||
_pi_numView = [[PIInputRedPacketView alloc]initWithFrame:CGRectZero];
|
||||
_pi_numView.isHiddenIcon = YES;
|
||||
_pi_numView.pi_title = YMLocalizedString(@"PIRoomSendRedPacketItemVC1");
|
||||
_pi_numView.unitTitle = YMLocalizedString(@"PIRoomSendRedPacketItemVC3");
|
||||
}
|
||||
return _pi_numView;
|
||||
}
|
||||
- (PIRedPacketChooseTypeView *)chooseTypeView{
|
||||
if(!_chooseTypeView){
|
||||
_chooseTypeView = [[PIRedPacketChooseTypeView alloc]initWithFrame:CGRectZero];
|
||||
_chooseTypeView.delegate = self;
|
||||
}
|
||||
return _chooseTypeView;
|
||||
}
|
||||
- (UIButton *)promptlyBtn{
|
||||
if(!_promptlyBtn){
|
||||
_promptlyBtn = [UIButton new];
|
||||
[_promptlyBtn setTitleColor:UIColorFromRGB(0xFF285C) forState:UIControlStateSelected];
|
||||
[_promptlyBtn setTitleColor:UIColorFromRGB(0x767585) forState:UIControlStateNormal];
|
||||
_promptlyBtn.titleLabel.font = kFontMedium(16);
|
||||
_promptlyBtn.backgroundColor = UIColorRGBAlpha(0xFF285C, 0.06);
|
||||
_promptlyBtn.layer.cornerRadius = kGetScaleWidth(8);
|
||||
_promptlyBtn.selected = YES;
|
||||
[_promptlyBtn setTitle:YMLocalizedString(@"PIRoomSendRedPacketItemVC4") forState:UIControlStateNormal];
|
||||
_promptlyBtn.layer.masksToBounds = YES;
|
||||
_promptlyBtn.layer.borderColor = UIColorFromRGB(0xFF285C).CGColor;
|
||||
_promptlyBtn.layer.borderWidth = 1;
|
||||
}
|
||||
return _promptlyBtn;
|
||||
}
|
||||
- (UIButton *)limitBtn{
|
||||
if(!_limitBtn){
|
||||
_limitBtn = [UIButton new];
|
||||
[_limitBtn setTitleColor:UIColorFromRGB(0xFF285C) forState:UIControlStateSelected];
|
||||
[_limitBtn setTitleColor:UIColorFromRGB(0x767585) forState:UIControlStateNormal];
|
||||
_limitBtn.titleLabel.font = kFontRegular(16);
|
||||
_limitBtn.backgroundColor = UIColorFromRGB(0xF8F8FA);
|
||||
_limitBtn.layer.cornerRadius = kGetScaleWidth(8);
|
||||
[_limitBtn setTitle:YMLocalizedString(@"PIRoomSendRedPacketItemVC5") forState:UIControlStateNormal];
|
||||
_limitBtn.layer.masksToBounds = YES;
|
||||
_limitBtn.layer.borderColor = UIColorFromRGB(0xFF285C).CGColor;
|
||||
_limitBtn.layer.borderWidth = 0;
|
||||
}
|
||||
return _limitBtn;
|
||||
}
|
||||
- (UIButton *)sendBtn{
|
||||
if(!_sendBtn){
|
||||
_sendBtn = [UIButton new];
|
||||
[_sendBtn setBackgroundImage:kImage(@"pi_red_packet_send") forState:UIControlStateNormal];
|
||||
}
|
||||
return _sendBtn;
|
||||
}
|
||||
- (UILabel *)tipsView{
|
||||
if(!_tipsView){
|
||||
_tipsView = [UILabel labelInitWithText:YMLocalizedString(@"PIRoomSendRedPacketItemVC6") font:kFontRegular(12) textColor:UIColorFromRGB(0x94959C)];
|
||||
}
|
||||
return _tipsView;
|
||||
}
|
||||
- (PIInputScrollingView *)scrollingView{
|
||||
if(!_scrollingView){
|
||||
_scrollingView = [[PIInputScrollingView alloc]initWithFrame:CGRectZero];
|
||||
_scrollingView.hidden = YES;
|
||||
}
|
||||
return _scrollingView;
|
||||
}
|
||||
- (PIInputEntireServerScrollingView *)serverInputView{
|
||||
if(!_serverInputView){
|
||||
_serverInputView = [[PIInputEntireServerScrollingView alloc]initWithFrame:CGRectZero];
|
||||
}
|
||||
return _serverInputView;
|
||||
}
|
||||
@end
|
||||
|
Reference in New Issue
Block a user