提交
This commit is contained in:
22
SweetParty/主类/RCMic/Room/RoomBotSelect【公屏筛选】/RoomPublicSelectView.h
Executable file
22
SweetParty/主类/RCMic/Room/RoomBotSelect【公屏筛选】/RoomPublicSelectView.h
Executable file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// RoomPublicSelectView.h
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by 马方圆 on 2021/5/22.
|
||||
// Copyright © 2021 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "RCMicRoomViewModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RoomPublicSelectView : UIView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame viewModel:(RCMicRoomViewModel *)viewModel;
|
||||
|
||||
@property (nonatomic, copy)void(^onSelectBlock)(void);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
70
SweetParty/主类/RCMic/Room/RoomBotSelect【公屏筛选】/RoomPublicSelectView.m
Executable file
70
SweetParty/主类/RCMic/Room/RoomBotSelect【公屏筛选】/RoomPublicSelectView.m
Executable file
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// RoomPublicSelectView.m
|
||||
// MoHuanXingYu
|
||||
//
|
||||
// Created by 马方圆 on 2021/5/22.
|
||||
// Copyright © 2021 MoHuanXingYu. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RoomPublicSelectView.h"
|
||||
|
||||
@interface RoomPublicSelectView ()
|
||||
|
||||
@property (nonatomic, strong) RCMicRoomViewModel *viewModel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomPublicSelectView
|
||||
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame viewModel:(RCMicRoomViewModel *)viewModel{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
_viewModel = viewModel;
|
||||
[self setup_UI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)setup_UI {
|
||||
NSArray *titles = @[@"全部",@"私聊",@"@TA",@"系统"];
|
||||
|
||||
for (int i=0; i<titles.count; i++) {
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[button setTitle:titles[i] forState:UIControlStateNormal];
|
||||
[button setTitleColor:kWhiteColor forState:UIControlStateNormal];
|
||||
button.titleLabel.font = [UIFont boldSystemFontOfSize:11];
|
||||
button.layer.cornerRadius = 12;
|
||||
button.clipsToBounds = YES;
|
||||
[self addSubview:button];
|
||||
button.frame = CGRectMake(10+60*i, 3, 50, 24);
|
||||
button.tag = 100+i;
|
||||
[button addTarget:self action:@selector(buttonClickMethod:) forControlEvents:UIControlEventTouchUpInside];
|
||||
if (i==0) {
|
||||
// [button styleGradiBlueColor];
|
||||
button.backgroundColor = kClearColor;
|
||||
[button setTitleColor:HEXCOLOR(0xFFFFFF) forState:UIControlStateNormal];
|
||||
}else{
|
||||
button.backgroundColor = kClearColor;
|
||||
[button setTitleColor:HEXCOLORA(0xFFFFFF, 0.5) forState:UIControlStateNormal];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
- (void)buttonClickMethod:(UIButton *)sender {
|
||||
|
||||
for (UIButton *button in self.subviews) {
|
||||
if (button.tag == sender.tag) {
|
||||
// button.backgroundColor = HEXCOLOR(0xFFE95E);
|
||||
[button setTitleColor:HEXCOLOR(0xFFFFFF) forState:UIControlStateNormal];
|
||||
}else{
|
||||
// button.backgroundColor = HEXCOLORA(0xFFFFFF, 0);
|
||||
[button setTitleColor:HEXCOLORA(0xFFFFFF, 0.5) forState:UIControlStateNormal];
|
||||
}
|
||||
}
|
||||
GVUSER.publicType = NSStringFormat(@"%ld",sender.tag-100);
|
||||
|
||||
if (self.onSelectBlock) {
|
||||
self.onSelectBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user