// // YOUPAIZYSelectSexWindow.m // VQU // // Created by Elaine on 2020/12/14. // Copyright © 2020 leo. All rights reserved. // #import "YOUPAIZYSelectSexWindow.h" #import "UIViewController+TFPresent.h" @interface YOUPAIZYSelectSexWindow () @end @implementation YOUPAIZYSelectSexWindow - (void)viewDidLoad { [super viewDidLoad]; // [self.view setFrame:CGRectMake(0, 0, _vWith, _vHeight)]; // CAShapeLayer *maskLayer = [CAShapeLayer layer]; // UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.view.bounds cornerRadius:16]; // maskLayer.path = path.CGPath; // self.view.layer.mask = maskLayer; // [self.view setBackgroundColor:[UIColor whiteColor]]; NSArray *btnimgArr_n = @[@"vqu_images_D_dynamic_girl_n",@"vqu_images_D_dynamic_boy_n"]; NSArray *btnimgArr_s= @[@"vqu_images_D_dynamic_girl_s",@"vqu_images_D_dynamic_boy_s"]; NSArray *btntitleArr = @[@"女生",@"男生"]; for (int i = 0; i< 2; i++) { UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake((self.vWidth-55*3)/2.0+(55+55)*i,20,55,75); [button setTitle:btntitleArr[i] forState:0]; button.titleLabel.font = LCFont(12); [button setTitleColor:HexColorFromRGB(0x666666) forState:0]; [button setImage:[UIImage imageNamed:btnimgArr_n[i]] forState:UIControlStateNormal]; [button setImage:[UIImage imageNamed:btnimgArr_s[i]] forState:UIControlStateSelected]; button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;//使图片和文字水平居中显示 [button setTitleEdgeInsets:UIEdgeInsetsMake(button.imageView.frame.size.height +10,-button.imageView.frame.size.width, 0.0,0.0)];//文字距离上边框的距离增加imageView的高度,距离左边框减少imageView的宽度,距离下边框和右边框距离不变 [button setImageEdgeInsets:UIEdgeInsetsMake(-20, 0.0,0.0, -button.titleLabel.bounds.size.width-10)];//图片距离右边框距离减少图片的宽度,其它不边 [button addTarget:self action:@selector(youpaifselectGenderAction:) forControlEvents:UIControlEventTouchUpInside]; [self.baseView addSubview:button]; button.selected = NO; button.tag = i+1; if (i+1 == self.youpaipgender) { button.selected = YES; } } UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake((self.vWidth - 95)/2.0,116,95,35); button.layer.cornerRadius = 17.5; button.layer.masksToBounds = YES; [button setTitle:@"确定" forState:0]; button.titleLabel.font = LCFont(14); [button setTitleColor:HexColorFromRGB(0xFFFFFF) forState:0]; // [button setBackgroundImage:[LCTools ColorImage:button.frame.size FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:(GradientLeftToRight)] forState:(UIControlStateNormal)]; [button setBackgroundColor:HexColorFromRGB(0xA7A9FD)]; [button addTarget:self action:@selector(youpaifsureAction) forControlEvents:UIControlEventTouchUpInside]; [self.baseView addSubview:button]; } -(void)youpaifselectGenderAction:(UIButton *)sender { UIButton *button1 = [self.baseView viewWithTag:1]; UIButton *button2 = [self.baseView viewWithTag:2]; button1.selected = NO; button2.selected = NO; sender.selected = YES; self.youpaipgender = sender.tag; } -(void)youpaifsureAction{ [self.youpaipdelegate youpaifSelectSexWindowAction:self.youpaipgender]; [self TFDismissViewController]; } @end