123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- //
- // JXselectSexView.m
- // shiku_im
- //
- // Created by 123 on 2020/6/8.
- // Copyright © 2020 Reese. All rights reserved.
- //
- #import "JXselectSexView.h"
-
- @interface JXselectSexView()<UITextViewDelegate>
- @property (nonatomic,weak) UIButton *tongYiBtn;
- @property (nonatomic,weak) JXselectSexView *show;
- @property (nonatomic,weak) UIButton *selectBtn;
- @end
- @implementation JXselectSexView
-
- -(instancetype)initWithFrame:(CGRect)frame{
-
- if (self=[super initWithFrame:frame]) {
- self.userInteractionEnabled=YES;
-
- UIView *backView=[[UIView alloc]init];
- backView.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.3];
- backView.userInteractionEnabled=YES;
- [self addSubview:backView];
- [backView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
- make.left.and.right.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- }];
-
- [backView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(closeBtn)]];
-
- UIView *whiteShowView=[[UIView alloc]init];
- whiteShowView.backgroundColor=[UIColor colorWithWhite:1.0 alpha:1.0];
- whiteShowView.layer.cornerRadius=15;
- whiteShowView.userInteractionEnabled=YES;
- whiteShowView.layer.masksToBounds=YES;
- [backView addSubview:whiteShowView];
- whiteShowView.frame=CGRectMake(20, (JX_SCREEN_HEIGHT-200)/2, JX_SCREEN_WIDTH-40, 200);
-
-
-
- UILabel *titleL=[[UILabel alloc]init];
- titleL.font=[UIFont systemFontOfSize:20 weight:UIFontWeightMedium];
- titleL.text=@"选择性别";
- [whiteShowView addSubview:titleL];
- titleL.frame=CGRectMake(20, 15, JX_SCREEN_WIDTH-40, 16);
-
- NSArray *titleS=@[@"男",@"女"];
- for (int i=0; i<titleS.count; i++) {
- UIButton *tongYiBtn=[[UIButton alloc]init];
- tongYiBtn.titleLabel.font=[UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
- [tongYiBtn setTitle:titleS[i] forState:UIControlStateNormal];
- [tongYiBtn setTitleColor:kRGBColor51 forState:UIControlStateNormal];
- [tongYiBtn setImage:[UIImage imageNamed:@"selected_fause"] forState:UIControlStateNormal];
- [tongYiBtn setImage:[UIImage imageNamed:@"selected_true"] forState:UIControlStateSelected];
- tongYiBtn.tag=i;
- [whiteShowView addSubview:tongYiBtn];
- tongYiBtn.frame=CGRectMake(20, CGRectGetMaxY(titleL.frame)+20+ i*(44+10), JX_SCREEN_WIDTH-40, 44);
- tongYiBtn.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
- [tongYiBtn addTarget:self action:@selector(tongyiBtn:) forControlEvents:UIControlEventTouchUpInside];
-
- if(i==0){
- tongYiBtn.selected=YES;
- self.selectBtn=tongYiBtn;
- }
-
-
- }
-
-
-
- }
-
- return self;
- }
- -(void)showView{
- JXselectSexView *show=[[JXselectSexView alloc]init];
- show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.7];
- show.frame=[UIScreen mainScreen].bounds;
- [[UIApplication sharedApplication].keyWindow addSubview:show];
-
-
- }
- +(void)closeView{
-
- }
- -(void)dissmisView{
-
- [self removeFromSuperview];
-
- }
- - (void)closeBtn{
- self.hidden=YES;
-
- }
- - (void)tongyiBtn:(UIButton *)sender{
-
- self.selectBtn.selected=NO;
- sender.selected=YES;
- self.selectBtn=sender;
-
-
- self.hidden=YES;
- if (_selectBtnBlock) {
- _selectBtnBlock(sender);
- }
- //[self removeFromSuperview];
- }
- @end
|