| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- //
- // MOCheckNotiView.m
- // MiMoLive
- //
- // Created by SuperC on 2025/6/3.
- //
- #import "MOCheckNotiView.h"
- @implementation MOCheckNotiView
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]){
- [self setupUI];
- self.backgroundColor = [UIColor whiteColor];
- }
- return self;
- }
- - (void)setupUI{
- [self addSubview:self.closeBtn];
- [self addSubview:self.openBtn];
- [self addSubview:self.contentLab];
-
- [self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.height.equalTo(@16.0);
- make.leading.equalTo(self).offset(8.0);
- make.centerY.equalTo(self.mas_centerY);
- }];
-
- [self.openBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.trailing.equalTo(self).offset(-12.0);
- make.height.equalTo(@24.0);
- make.width.equalTo(@66.0);
- make.centerY.equalTo(self.mas_centerY);
- }];
-
- [self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.leading.equalTo(self.closeBtn.mas_trailing).offset(8.0);
- make.trailing.equalTo(self.openBtn.mas_leading).offset(-8.0);
- make.top.equalTo(self).offset(8.0);
- make.bottom.equalTo(self).offset(-8.0);
- }];
- }
- - (CGFloat)getTheViewHeight{
- CGFloat theContentWidth = SCREENWIDTH - 12.0 * 2.0 - 8.0 - 16.0 - 8.0 - 12.0 - 66.0;
- CGFloat theContentHeight = [MOTools calculateRowHeight:NSLocalString(@"mimo_2_chat_noti_check_tip") font:[UIFont systemFontOfSize:12.0] andWidth:theContentWidth];
- CGFloat theViewHeight = theContentHeight + 8.0 * 2.0;
- if(theViewHeight < 44.0){
- theViewHeight = 44.0;
- }
- return theViewHeight;
- }
- #pragma mark - Lazy
- - (BigBtn *)closeBtn{
- if (!_closeBtn) {
- _closeBtn = [BigBtn buttonWithType:UIButtonTypeCustom];
- [_closeBtn setImage:[UIImage imageNamed:@"icon_2_close"] forState:UIControlStateNormal];
- [_closeBtn addTarget:self action:@selector(closeAction:) forControlEvents:UIControlEventTouchUpInside];
- }
- return _closeBtn;
- }
- - (void)closeAction:(UIButton *)sender{
- self.closeClickBlock ? self.closeClickBlock() : nil;
- }
- - (BigBtn *)openBtn{
- if (!_openBtn) {
- _openBtn = [BigBtn buttonWithType:UIButtonTypeCustom];
- NSArray *colorArr = @[kBaseColorLeft,kBaseColorRight];
- UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 66, 24.0) Colors:colorArr GradientType:0];
- [_openBtn setBackgroundImage:image forState:UIControlStateNormal];
- [_openBtn addTarget:self action:@selector(openAction:) forControlEvents:UIControlEventTouchUpInside];
- [_openBtn setTitle:NSLocalString(@"mimo_2_chat_noti_open") forState:UIControlStateNormal];
- [_openBtn setFont:[MOTextTools getTheFontWithSize:12.0 AndFontName:kPoppinsMediumFontStr]];
- _openBtn.layer.cornerRadius = 8.0;
- _openBtn.layer.masksToBounds = YES;
- }
- return _openBtn;
- }
- - (void)openAction:(UIButton *)sender{
- NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
- if ([[UIApplication sharedApplication] canOpenURL:settingsURL]) {
- [[UIApplication sharedApplication] openURL:settingsURL options:@{} completionHandler:nil];
- }
- }
- - (UILabel *)contentLab{
- if (!_contentLab) {
- _contentLab = [[UILabel alloc] init];
- _contentLab.textColor = kBaseTextColor_1;
- _contentLab.font = [UIFont systemFontOfSize:12.0];
- _contentLab.textAlignment = NSTextAlignmentLeft;
- _contentLab.text = NSLocalString(@"mimo_2_chat_noti_check_tip");
- _contentLab.numberOfLines = 0;
- }
- return _contentLab;
- }
- @end
|