123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- //
- // HRPopView.m
- // VQU
- //
- // Created by xiaohaoran on 2021/10/27.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "HRPopView.h"
- #define MarginPadding (17.0f)
- @interface HRPopView ()
- @property(nonatomic,strong)UITextView *contTextV;
- @end
- @implementation HRPopView
- - (instancetype)initWithFrame:(CGRect)frame Model:(YOUPAILZEndLiveHintModel *)model{
- if (self = [super initWithFrame:CGRectZero]) {
- // _model = model;
- [self youpaifsetSubView];
- }
- return self;
- }
- - (void)youpaifsetSubView {
-
- [[UIApplication sharedApplication].keyWindow addSubview:self];
-
- // [UIView animateWithDuration:0.25 animations:^{
- self.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
- // }];
-
- [self youpaifinitUI];
-
- }
- - (void)youpaifinitUI{
-
- CGFloat bgViewHight = 0;
-
- UIView *bgView = [UIView new];
- [self addSubview:bgView];
- [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(14);
- make.right.mas_equalTo(-14);
- make.top.mas_equalTo(125);
- make.height.mas_equalTo(307);
- }];
- bgView.backgroundColor = [UIColor clearColor];
-
- //arrView
- UIView *arrowView = [UIView new];
- [bgView addSubview:arrowView];
- [arrowView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(0);
- make.height.mas_equalTo(0);
- }];
- arrowView.backgroundColor = [UIColor clearColor];
-
- UIImageView *arrowV = [[UIImageView alloc] init];
- [arrowView addSubview:arrowV];
- [arrowV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(17.5);
- make.top.mas_equalTo(0);
- make.size.mas_equalTo(CGSizeMake(19, 9));
- }];
- arrowV.image = [UIImage imageNamed:@"vqu_images_L_arrow_top"];
-
- bgViewHight+=9;
-
- UIView *subBgView = [UIView new];
- [bgView addSubview:subBgView];
- [subBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(arrowV.mas_bottom).offset(-2);
- make.height.mas_equalTo(307);
- }];
- subBgView.backgroundColor = LCBkgColor;
- subBgView.layer.cornerRadius = 5;
- subBgView.layer.masksToBounds = YES;
- subBgView.layer.borderWidth = 0.5;
- subBgView.layer.borderColor = HexColorFromRGB(0x4F4B5B).CGColor;
-
-
- //标题
- UILabel *titleL = [[UILabel alloc] init];
- [subBgView addSubview:titleL];
- [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(20);
- make.left.mas_equalTo(17);
- }];
- titleL.font = [UIFont systemFontOfSize:18];
- titleL.textColor = HexColorFromRGB(0xffffff);
- titleL.text = @"房间公告";
-
- bgViewHight+=18;
- NSString *contentStr = @"这里是蓝朵朵每天和朋友啰嗦的小屋,\n期待每天10-1220-22与你们的遇见,\n给你们讲我们这些年不曾告诉别人的故事,\n也守着你们听你们只想告诉我们的故事,\n如果声音有温度,朵朵愿用声音温暖你们的心,\n守着你们,陪着你们在相遇的每一分每一秒";
- //内容
- UITextView* contTextView = [[UITextView alloc]init];
- self.contTextV = contTextView;
- [self addSubview:contTextView];
- [contTextView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(MarginPadding);
- make.top.mas_equalTo(titleL.mas_bottom).offset(20);
- make.right.mas_equalTo(-MarginPadding);
- make.height.mas_equalTo(120);
- }];
- [contTextView setBackgroundColor:[UIColor clearColor]];
- contTextView.scrollEnabled = NO;
- // contTextView.backgroundColor = [UIColor redColor];
- // contTextView.userInteractionEnabled = YES;
- // contTextView.numberOfLines = 0;
- // contTextView.lineBreakMode = NSLineBreakByWordWrapping;
- contTextView.textColor = [UIColor whiteColor];
- contTextView.font = [UIFont systemFontOfSize:14];
- contTextView.text = nil;
- contTextView.text = contentStr;
- contTextView.editable = NO;
- // contTextView.layer.masksToBounds = YES;
-
-
- CGSize constraint = CGSizeMake(contTextView.contentSize.width, CGFLOAT_MAX);
-
- // CGSize size = [self.dyModel.content sizeWithFont:[UIFont systemFontOfSize:17] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
- CGRect rect = [contentStr boundingRectWithSize:constraint
- options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
- attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12],
- NSForegroundColorAttributeName : LCTextBlack
- }
- context:nil];
- CGFloat textH = rect.size.height ;
- bgViewHight+= rect.size.height+20;
- contTextView.frame = CGRectMake(MarginPadding, CGRectGetMaxX(titleL.frame)+20, KScreenWidth-MarginPadding*2, textH);
- NSString *contentStr1 = LCStr(word36);//@"守护收费:\n甜蜜守护20000钻/周\n心动守护52000钻/周\n唯一守护131400钻/周";
- //提示
- UITextView* hintTextView = [[UITextView alloc]init];
- [self addSubview:hintTextView];
- [hintTextView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(MarginPadding);
- make.top.mas_equalTo(contTextView.mas_bottom).offset(20);
- make.right.mas_equalTo(-MarginPadding);
- make.height.mas_equalTo(120);
- }];
- [hintTextView setBackgroundColor:[UIColor clearColor]];
- hintTextView.scrollEnabled = NO;
- hintTextView.textColor = [UIColor whiteColor];
- hintTextView.font = [UIFont systemFontOfSize:14];
- hintTextView.text = contentStr1;
- hintTextView.editable = NO;
-
- CGSize constraint1 = CGSizeMake(hintTextView.contentSize.width, CGFLOAT_MAX);
-
- // CGSize size = [self.dyModel.content sizeWithFont:[UIFont systemFontOfSize:17] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
- CGRect rect1 = [contentStr1 boundingRectWithSize:constraint1
- options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
- attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12],
- NSForegroundColorAttributeName : LCTextBlack
- }
- context:nil];
- CGFloat textH1 = rect1.size.height ;
- bgViewHight+=textH1+20;
- hintTextView.frame = CGRectMake(MarginPadding, CGRectGetMaxX(contTextView.frame)+20, KScreenWidth-MarginPadding*2, bgViewHight);
- bgView.frame = CGRectMake(15, 180, KScreenWidth-30, textH1);
- }
- -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
-
- [UIView animateWithDuration:0.0 animations:^{
- self.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
- } completion:^(BOOL finished) {
- [self removeFromSuperview];
- }];
- }
- @end
|