消息页面UI修改

This commit is contained in:
chenshuanglin
2023-03-08 18:52:49 +08:00
parent f8e2c5e0a1
commit 47408eb687
18 changed files with 210 additions and 53 deletions

View File

@@ -29,11 +29,6 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
@interface SessionListViewController ()<UITableViewDataSource, UITableViewDelegate, NIMLoginManagerDelegate, NIMConversationManagerDelegate, XPSessionListHeadViewDelegate>
@property (nonatomic,strong) UIView *customNavigationBar;
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic, strong) UIButton *allReadButton;
@property (nonatomic, strong) XPSessionListHeadView *headView;
/**
*
@@ -139,29 +134,18 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
} uid:uid];
}
- (void)initViews {
self.title = @"消息";
if (self.openType == SessionListOpenTypeDefault) {
[self.customNavigationBar addSubview:self.titleLabel];
[self.view addSubview:self.customNavigationBar];
[self.customNavigationBar addSubview:self.allReadButton];
[self.view addSubview:self.headView];
self.view.backgroundColor = UIColor.clearColor;
}
[self.view addSubview:self.sessionListView];
}
- (void)initLayout {
if (self.openType == SessionListOpenTypeDefault) {
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.customNavigationBar);
}];
[self.allReadButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.width.height.mas_equalTo(30);
make.centerY.mas_equalTo(self.customNavigationBar);
}];
[self.headView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(0);
make.top.mas_equalTo(self.customNavigationBar.mas_bottom).mas_offset(8);
make.top.mas_equalTo(8);
}];
}
@@ -413,7 +397,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
}
#pragma mark - action
- (void)allReadButtonClick:(UIButton *)sender {
- (void)allRead {
NSInteger count = [NIMSDK sharedSDK].conversationManager.allUnreadCount;
if (count<1) {
[self showErrorToast:@"暂无未读消息需要清理"];
@@ -435,26 +419,6 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
}];
}
- (UIView *)customNavigationBar {
if (!_customNavigationBar) {
CGRect frame = CGRectMake(0, kStatusBarHeight, KScreenWidth, 44);
_customNavigationBar = [[UIView alloc]initWithFrame:frame];
}
return _customNavigationBar;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.font = [UIFont systemFontOfSize:18.f weight:UIFontWeightMedium];
_titleLabel.textColor = ThemeColor.mainTextColor;
_titleLabel.text = @"消息";
}
return _titleLabel;
}
- (UITableView *)sessionListView {
if (!_sessionListView) {
_sessionListView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
@@ -474,15 +438,6 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
return _recentSessions;
}
- (UIButton *)allReadButton {
if (!_allReadButton) {
_allReadButton = [[UIButton alloc] init];
[_allReadButton setImage:[UIImage imageNamed:@"sessionList_clear"] forState:UIControlStateNormal];
[_allReadButton addTarget:self action:@selector(allReadButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _allReadButton;
}
- (XPTeenagerHomeView *)teenagerView {
if (!_teenagerView) {
_teenagerView = [[XPTeenagerHomeView alloc] init];