From ff8a6e2095e3b7d3d9e12ed1b832b42ca9139903 Mon Sep 17 00:00:00 2001 From: fengshuo <963787902@qq.com> Date: Tue, 15 Mar 2022 11:16:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=85=AC=E5=91=8A=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xplan-ios.xcodeproj/project.pbxproj | 6 + .../XPRoomFunctionContainerView.m | 18 +-- .../View/Setting/View/XPRoomTopicAlertView.h | 19 +++ .../View/Setting/View/XPRoomTopicAlertView.m | 124 ++++++++++++++++++ 4 files changed, 156 insertions(+), 11 deletions(-) create mode 100644 xplan-ios/Main/Room/View/Setting/View/XPRoomTopicAlertView.h create mode 100644 xplan-ios/Main/Room/View/Setting/View/XPRoomTopicAlertView.m diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 2285eeea..6804a54c 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -212,6 +212,7 @@ E80DE40A277568D300BE5BCB /* ThemeColor+FirstRecharge.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE409277568D300BE5BCB /* ThemeColor+FirstRecharge.m */; }; E80DE40D2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE40C2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m */; }; E80DE4102775C34E00BE5BCB /* XPFirstRechargeSuccessView.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE40F2775C34E00BE5BCB /* XPFirstRechargeSuccessView.m */; }; + E80E900C27E0358900434B90 /* XPRoomTopicAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = E80E900B27E0358900434B90 /* XPRoomTopicAlertView.m */; }; E811FFF72742367B00918544 /* XPGiftEmptyCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E811FFF62742367B00918544 /* XPGiftEmptyCollectionViewCell.m */; }; E8133916273E532D00708B66 /* XPGiftItemCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8133915273E532D00708B66 /* XPGiftItemCollectionViewCell.m */; }; E81366E326F0A1FC0076364C /* LoginBindPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E81366E226F0A1FC0076364C /* LoginBindPhoneViewController.m */; }; @@ -961,6 +962,8 @@ E80DE40C2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFirstRechargeFlowLayout.m; sourceTree = ""; }; E80DE40E2775C34E00BE5BCB /* XPFirstRechargeSuccessView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFirstRechargeSuccessView.h; sourceTree = ""; }; E80DE40F2775C34E00BE5BCB /* XPFirstRechargeSuccessView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFirstRechargeSuccessView.m; sourceTree = ""; }; + E80E900A27E0358900434B90 /* XPRoomTopicAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTopicAlertView.h; sourceTree = ""; }; + E80E900B27E0358900434B90 /* XPRoomTopicAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomTopicAlertView.m; sourceTree = ""; }; E811FFF52742367B00918544 /* XPGiftEmptyCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftEmptyCollectionViewCell.h; sourceTree = ""; }; E811FFF62742367B00918544 /* XPGiftEmptyCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftEmptyCollectionViewCell.m; sourceTree = ""; }; E8133914273E532D00708B66 /* XPGiftItemCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftItemCollectionViewCell.h; sourceTree = ""; }; @@ -3229,6 +3232,8 @@ E87E91542796B6DE00A7B3F2 /* XPRoomInviteUserViewController.m */, E8AA6EED27DF1E6B009B4C2B /* XPRoomTopicViewController.h */, E8AA6EEE27DF1E6B009B4C2B /* XPRoomTopicViewController.m */, + E80E900A27E0358900434B90 /* XPRoomTopicAlertView.h */, + E80E900B27E0358900434B90 /* XPRoomTopicAlertView.m */, ); path = View; sourceTree = ""; @@ -4713,6 +4718,7 @@ E8A6C29527CF441200AC7442 /* XPHomeAttentionCollectionViewCell.m in Sources */, E8EEB8F726FC2673007C6EBA /* UserPhoto.m in Sources */, E81C27A226EF23490031E639 /* XPEnum.h in Sources */, + E80E900C27E0358900434B90 /* XPRoomTopicAlertView.m in Sources */, 9BB54966278303EB0090CD26 /* XPNobleCenterNavView.m in Sources */, 9B92A36327980DCC00AD168F /* Api+SkillCard.m in Sources */, E88B5CB526FB20B800DA9178 /* XPMineTeenagerPwdView.m in Sources */, diff --git a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m index 3e7504c4..0152a458 100644 --- a/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m +++ b/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomFunctionContainerView.m @@ -32,6 +32,7 @@ #import "XPRoomAnchorInfoCardView.h" #import "AnchorGiftValueView.h" #import "XPRoomTopicViewController.h" +#import "XPRoomTopicAlertView.h" @interface XPRoomFunctionContainerView () ///host 代理 @property (nonatomic,weak) iddelegate; @@ -287,17 +288,12 @@ editTopicVC.roomInfo = roomInfo; [self.delegate.getCurrentNav pushViewController:editTopicVC animated:YES]; } else { - NSString * title = roomInfo.roomDesc.length > 0 ? roomInfo.roomDesc : @"暂未设置话题"; - TTAlertConfig * config = [[TTAlertConfig alloc] init]; - config.title = title; - config.message = roomInfo.introduction.length > 0 ? roomInfo.introduction : @"暂未设置房间话题"; - config.actionStyle = TTAlertActionCancelStyle; - config.cancelButtonConfig.title = @"关闭"; - [TTPopup alertWithConfig:config confirmHandler:^{ - - } cancelHandler:^{ - - }]; + TTPopupService * config = [[TTPopupService alloc] init]; + XPRoomTopicAlertView * alertView = [[XPRoomTopicAlertView alloc] init]; + alertView.title = roomInfo.roomDesc; + alertView.message = roomInfo.introduction; + config.contentView = alertView; + [TTPopup popupWithConfig:config]; } } }]; diff --git a/xplan-ios/Main/Room/View/Setting/View/XPRoomTopicAlertView.h b/xplan-ios/Main/Room/View/Setting/View/XPRoomTopicAlertView.h new file mode 100644 index 00000000..ba830fa9 --- /dev/null +++ b/xplan-ios/Main/Room/View/Setting/View/XPRoomTopicAlertView.h @@ -0,0 +1,19 @@ +// +// XPRoomTopicAlertView.h +// xplan-ios +// +// Created by 冯硕 on 2022/3/15. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XPRoomTopicAlertView : UIView +///显示标题 +@property (nonatomic,copy) NSString *title; +///显示内容 +@property (nonatomic,copy) NSString *message; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/Setting/View/XPRoomTopicAlertView.m b/xplan-ios/Main/Room/View/Setting/View/XPRoomTopicAlertView.m new file mode 100644 index 00000000..f3a7dc8d --- /dev/null +++ b/xplan-ios/Main/Room/View/Setting/View/XPRoomTopicAlertView.m @@ -0,0 +1,124 @@ +// +// XPRoomTopicAlertView.m +// xplan-ios +// +// Created by 冯硕 on 2022/3/15. +// + +#import "XPRoomTopicAlertView.h" +///Third +#import +///Tool +#import "ThemeColor.h" +#import "UIImage+Utils.h" +#import "TTPopup.h" +#import "XPMacro.h" + +@interface XPRoomTopicAlertView () + +///显示标题 +@property (nonatomic,strong) UILabel *titleLabel; +///显示文本 +@property (nonatomic,strong) UITextView *textView; +///关闭按钮 +@property (nonatomic,strong) UIButton *closeButton; + +@end + +@implementation XPRoomTopicAlertView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self initSubViews]; + [self initSubViewConstraints]; + } + return self; +} + +#pragma mark - Private Method +- (void)initSubViews { + self.layer.masksToBounds = YES; + self.layer.cornerRadius = 15; + self.backgroundColor = [UIColor whiteColor]; + [self addSubview:self.titleLabel]; + [self addSubview:self.textView]; + [self addSubview:self.closeButton]; +} + +- (void)initSubViewConstraints { + [self mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(KScreenWidth - 40 * 2); + make.bottom.mas_equalTo(self.closeButton.mas_bottom).offset(20); + }]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.mas_equalTo(self).inset(20); + }]; + + [self.textView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(self).inset(20); + make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(15); + make.height.mas_equalTo(200); + }]; + + [self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(124, 44)); + make.top.mas_equalTo(self.textView.mas_bottom).offset(20); + make.centerX.mas_equalTo(self); + }]; +} + +#pragma mark - Event Response +- (void)closeButtonAction:(UIButton *)sender { + [TTPopup dismiss]; +} + +#pragma mark - Getters And Setters +- (void)setTitle:(NSString *)title { + _title = title; + self.titleLabel.text = _title.length > 0 ? _title : @"暂无设置话题"; +} + +- (void)setMessage:(NSString *)message { + _message = message; + self.textView.text = _message.length > 0 ? _message : @"暂未设置话题内容"; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[UILabel alloc] init]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + _titleLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size:16]; + _titleLabel.textColor = [ThemeColor mainTextColor]; + } + return _titleLabel; +} + +- (UITextView *)textView { + if (!_textView) { + _textView = [[UITextView alloc] init]; + _textView.textColor = [ThemeColor mainTextColor]; + _textView.backgroundColor = [UIColor clearColor]; + _textView.font = [UIFont systemFontOfSize:15]; + _textView.editable = NO; + } + return _textView; +} + +- (UIButton *)closeButton { + if (!_closeButton) { + _closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_closeButton setTitle:@"关闭" forState:UIControlStateNormal]; + [_closeButton setTitleColor:[ThemeColor cancelButtonTextColor] forState:UIControlStateNormal]; + _closeButton.titleLabel.font = [UIFont systemFontOfSize:15]; + [_closeButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor], [ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + _closeButton.layer.masksToBounds = YES; + _closeButton.layer.cornerRadius = 22; + [_closeButton addTarget:self action:@selector(closeButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _closeButton; +} + +@end