123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- //
- // JXMoneyShareView.m
- // shiku_im
- //
- // Created by 123 on 2020/6/22.
- // Copyright © 2020 Reese. All rights reserved.
- //
- #import "JXBigReelView.h"
-
- @interface JXBigReelView()<UITextViewDelegate>
- @property (nonatomic,weak)UILabel *timeStr;
- @property (nonatomic,weak) JXBigReelView *show;
- @property (nonatomic,weak) UIImageView *subIMG;
- @end
- @implementation JXBigReelView
-
- -(instancetype)initWithFrame:(CGRect)frame{
-
- if (self=[super initWithFrame:frame]) {
-
- UIView *backView=[[UIView alloc]init];
- backView.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.3];
- [self addSubview:backView];
- [backView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
- make.left.and.right.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- }];
-
- UIImageView *whiteShowView=[[UIImageView alloc]init];
- whiteShowView.image=[UIImage imageNamed:@"中奖底板"];
- whiteShowView.userInteractionEnabled=YES;
- [backView addSubview:whiteShowView];
- [whiteShowView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(backView.mas_centerX);
- make.centerY.mas_equalTo(backView.mas_centerY);
- //make.left.mas_equalTo(50);
- // make.right.mas_equalTo(-50);
- //make.height.mas_equalTo(JX_SCREEN_HEIGHT/3);
- }];
-
- UIImageView *gongXi=[[UIImageView alloc]init];
- gongXi.image=[UIImage imageNamed:@"恭喜您"];
- gongXi.userInteractionEnabled=YES;
- [whiteShowView addSubview:gongXi];
- [gongXi mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.mas_equalTo(whiteShowView.mas_centerY).mas_offset(8);
- make.centerX.mas_equalTo(whiteShowView.mas_centerX);
- }];
-
-
- UIImageView *titleIMG=[[UIImageView alloc]init];
- titleIMG.image=[UIImage imageNamed:@"抽中"];
- [whiteShowView addSubview:titleIMG];
- [titleIMG mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(25);
- make.top.mas_equalTo(gongXi.mas_bottom).mas_equalTo(8);
- }];
-
- UILabel *subtitle=[[UILabel alloc]init];
- subtitle.text=@"1";
- subtitle.textColor=[UIColor yellowColor];
- subtitle.font=[UIFont systemFontOfSize:20 weight:UIFontWeightMedium];
- [whiteShowView addSubview:subtitle];
- self.subtitle=subtitle;
- [subtitle mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(titleIMG.mas_right).mas_equalTo(8);
- make.centerY.mas_equalTo(titleIMG.mas_centerY);
- }];
- UIImageView *leveleIMG=[[UIImageView alloc]init];
- leveleIMG.image=[UIImage imageNamed:@"等奖拷贝"];
- leveleIMG.userInteractionEnabled=YES;
- [whiteShowView addSubview:leveleIMG];
- [leveleIMG mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(subtitle.mas_right).mas_equalTo(8);
- make.centerY.mas_equalTo(subtitle.mas_centerY);
- }];
- UILabel *moneyTitle=[[UILabel alloc]init];
- moneyTitle.text=@"888";
- moneyTitle.textColor=[UIColor yellowColor];
- moneyTitle.font=[UIFont systemFontOfSize:36 weight:UIFontWeightMedium];
- [whiteShowView addSubview:moneyTitle];
- self.moneyTitle=moneyTitle;
- [moneyTitle mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(leveleIMG.mas_right).mas_equalTo(8);
- make.centerY.mas_equalTo(subtitle.mas_centerY);
- }];
-
- UIImageView *yuanIMG=[[UIImageView alloc]init];
- yuanIMG.image=[UIImage imageNamed:@"元"];
- [whiteShowView addSubview:yuanIMG];
- [yuanIMG mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(moneyTitle.mas_right).mas_equalTo(8);
- make.centerY.mas_equalTo(subtitle.mas_centerY);
- }];
-
- UIImageView *titleLL=[[UIImageView alloc]init];
- titleLL.image=[UIImage imageNamed:@"fenshaTitle"];
- titleLL.userInteractionEnabled=YES;
- [whiteShowView addSubview:titleLL];
- [titleLL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(moneyTitle.mas_bottom).mas_equalTo(5);
- make.centerX.mas_equalTo(whiteShowView.mas_centerX);
- }];
-
- UIButton *tongYiBtn=[[UIButton alloc]init];
- tongYiBtn.titleLabel.font=[UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
- [tongYiBtn setImage:[UIImage imageNamed:@"zyjShare"] forState:UIControlStateNormal];
- tongYiBtn.layer.cornerRadius=6;
- tongYiBtn.layer.masksToBounds=YES;
- [whiteShowView addSubview:tongYiBtn];
- [tongYiBtn addTarget:self action:@selector(tongyiBtn:) forControlEvents:UIControlEventTouchUpInside];
- [tongYiBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.mas_equalTo(-10);
- make.centerX.mas_equalTo(whiteShowView.mas_centerX);
- }];
-
- // [self thirdBtnAction];
- }
-
- return self;
- }
- - (void)setStrURL:(NSDictionary *)strURL{
-
- NSString *rewardCode=[NSString stringWithFormat:@"%@",strURL[@"rewardCode"]];;
- NSString *moneyLL=[NSString stringWithFormat:@"%@",strURL[@"money"]];
-
- _subtitle.text = rewardCode;
- _moneyTitle.text = moneyLL;
-
- }
- - (void)thirdBtnAction {
- __block NSInteger second = 5;
- //(1)
- dispatch_queue_t quene = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
- //(2)
- dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, quene);
- //(3)
- dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
- //(4)
- dispatch_source_set_event_handler(timer, ^{
- dispatch_async(dispatch_get_main_queue(), ^{
- if (second == 0) {
- self.tongYiBtn.userInteractionEnabled = YES;
- [self.tongYiBtn setTitle:[NSString stringWithFormat:@"5秒自动关闭"] forState:UIControlStateNormal];
- // second = 10;
- //(6)
- dispatch_cancel(timer);
- [self removeFromSuperview];
- } else {
- self.tongYiBtn.userInteractionEnabled = NO;
- [self.tongYiBtn setTitle:[NSString stringWithFormat:@"(%ld)秒自动关闭",(long)second] forState:UIControlStateNormal];
- second--;
- }
- });
- });
- //(5)
- dispatch_resume(timer);
- }
-
- +(void)showView{
- JXBigReelView *show=[[JXBigReelView alloc]init];
- show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.7];
- show.frame=[UIScreen mainScreen].bounds;
- [[UIApplication sharedApplication].keyWindow addSubview:show];
-
-
- }
-
- -(void)dissmisView{
-
- [self removeFromSuperview];
-
- }
- - (void)tongyiBtn:(UIButton *)sender{
-
- [self removeFromSuperview];
- [g_notify postNotificationName:@"comeBackxxx" object:nil];
- //
- }
- @end
|