85 lines
2.6 KiB
Objective-C
Executable File
85 lines
2.6 KiB
Objective-C
Executable File
//
|
|
// RoomSearchView.m
|
|
// MoHuanXingYu
|
|
//
|
|
// Created by aa on 2019/7/4.
|
|
// Copyright © 2019 MoHuanXingYu. All rights reserved.
|
|
//
|
|
|
|
#import "RoomSearchView.h"
|
|
|
|
|
|
@interface RoomSearchView ()<UITextFieldDelegate>
|
|
|
|
|
|
@property (nonatomic, strong) UIButton *queDingButton;
|
|
|
|
@end
|
|
|
|
@implementation RoomSearchView
|
|
|
|
#pragma mark - Intial
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
|
self = [super initWithFrame:frame];
|
|
if (self) {
|
|
self.backgroundColor = [UIColor whiteColor];
|
|
[self setUpUI];
|
|
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)quDingButtonClick:(UIButton *)sender{
|
|
if ([self.searchTF.text isEqualToString:@""]) {
|
|
[SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"请输入ID"];
|
|
}else{
|
|
! self.quDingButtonClickBlock ?: self.quDingButtonClickBlock(self.searchTF.text);
|
|
}
|
|
}
|
|
|
|
|
|
- (void)setUpUI{
|
|
[self addSubview:self.searchTF];
|
|
[self addSubview:self.queDingButton];
|
|
|
|
[self.queDingButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.mas_equalTo(self).offset(-12);
|
|
make.centerY.mas_equalTo(self);
|
|
make.height.mas_equalTo(30);
|
|
make.width.mas_equalTo(60);
|
|
}];
|
|
|
|
[self.searchTF mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(self).offset(12);
|
|
make.height.mas_equalTo(35);
|
|
make.centerY.mas_equalTo(self);
|
|
make.right.mas_equalTo(self.queDingButton.mas_left).offset(-16);
|
|
}];
|
|
|
|
}
|
|
- (UITextField *)searchTF{
|
|
if (!_searchTF) {
|
|
_searchTF = [ControlCreator createTextField:nil rect:CGRectMake(0, 0, 0, 0) placeholder:@"输入用户ID" placeholderColor:nil text:@"" font:Font(12) color:mainViceColor backguoundColor:MHColorFromHexString(@"#F8F8F8")];
|
|
_searchTF.delegate = self;
|
|
_searchTF.layer.masksToBounds = YES;
|
|
_searchTF.layer.cornerRadius = 17.5;
|
|
_searchTF.keyboardType = UIKeyboardTypeNumberPad;
|
|
UIView *leftTFView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 35)];
|
|
leftTFView.backgroundColor = [UIColor clearColor];
|
|
_searchTF.leftView = leftTFView;
|
|
_searchTF.leftViewMode = UITextFieldViewModeAlways;
|
|
}
|
|
return _searchTF;
|
|
}
|
|
- (UIButton *)queDingButton{
|
|
if (!_queDingButton) {
|
|
_queDingButton = [ControlCreator createButton:nil rect:CGRectZero text:@"确定" font:Font(13) color:[UIColor whiteColor] backguoundColor:MLControlsColor imageName:nil target:self action:@selector(quDingButtonClick:)];
|
|
_queDingButton.layer.masksToBounds = YES;
|
|
_queDingButton.layer.cornerRadius = 7;
|
|
}
|
|
return _queDingButton;
|
|
}
|
|
|
|
@end
|