// // YOUPAILZCheckDynamicTypeWindow.m // MSYOUPAI // // Created by CY on 2022/3/7. // Copyright © 2022 MS. All rights reserved. // #import "YOUPAILZCheckDynamicTypeWindow.h" @interface YOUPAILZCheckDynamicTypeWindow () @end @implementation YOUPAILZCheckDynamicTypeWindow - (void)viewDidLoad { [super viewDidLoad]; self.baseView.hidden = YES; [self youpaifinitUI]; } - (void)youpaifinitUI{ UIView *bgV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 178.0f + SafeHeight)]; bgV.backgroundColor = [UIColor whiteColor]; [self.view addSubview:bgV]; [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:bgV size:CGSizeMake(16.0f, 16.0f)]; [bgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.bottom.offset(0.0f); make.height.offset(178.0f + SafeHeight); }]; NSMutableArray *btns = [NSMutableArray array]; NSArray *contents = @[ @{@"image":@"vqu_images_dynamic_send_image",@"title":@"发布图片"}, @{@"image":@"vqu_images_dynamic_send_video",@"title":@"发布视频"}, ]; for (NSInteger i = 0; i < 2; i ++) { UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.tag = i; [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; [bgV addSubview:btn]; [btns addObject:btn]; UIImageView *imgV = [[UIImageView alloc] init]; imgV.image = [UIImage imageNamed:contents[i][@"image"]]; [btn addSubview:imgV]; [imgV mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(btn); make.top.offset(0.0f); make.size.mas_offset(CGSizeMake(53.0f, 53.0f)); }]; UILabel *titleL = [[UILabel alloc] init]; titleL.font = LCFont(11.0f); titleL.textColor = LZ475A7DColor; titleL.textAlignment = NSTextAlignmentCenter; titleL.text = contents[i][@"title"]; [btn addSubview:titleL]; [titleL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.offset(0.0f); make.top.equalTo(imgV.mas_bottom).offset(5.0f); }]; } CGFloat space = (KScreenWidth - (53.0f * contents.count)) / contents.count; [btns mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:space leadSpacing:space/2 tailSpacing:space/2]; [btns mas_makeConstraints:^(MASConstraintMaker *make) { make.top.offset(45.0f); make.height.offset(72.0f); }]; UIButton *cencalBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [cencalBtn setImage:[UIImage imageNamed:@"vqu_images_dynamic_send_cencal"] forState:UIControlStateNormal]; [cencalBtn addTarget:self action:@selector(cencalBtnClick) forControlEvents:UIControlEventTouchUpInside]; [bgV addSubview:cencalBtn]; [cencalBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.offset(-SafeHeight-12.0f); make.centerX.equalTo(bgV); make.size.mas_offset(CGSizeMake(25.0f, 25.0f)); }]; } - (void)btnClick:(UIButton *)sender{ [self dismissViewControllerAnimated:YES completion:^{ if (self.selectedSendDynamicTypeBlock != nil) { self.selectedSendDynamicTypeBlock(sender.tag); } }]; } - (void)cencalBtnClick{ [self dismissViewControllerAnimated:YES completion:nil]; } @end