123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- //
- // YOUPAILZLiveProtocolWindow.m
- // VQU
- //
- // Created by CY on 2021/7/28.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZLiveProtocolWindow.h"
- #import <WebKit/WebKit.h>
- @interface YOUPAILZLiveProtocolWindow ()<WKUIDelegate,WKNavigationDelegate>
- @end
- @implementation YOUPAILZLiveProtocolWindow
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.baseView.hidden = YES;
- [self youpaifinitUI];
- }
- - (void)youpaifinitUI{
- UIView *bgV = [[UIView alloc] init];
- bgV.backgroundColor = HexColorFromRGB(0x2A2935);
- bgV.layer.cornerRadius = 10.0f;
- bgV.clipsToBounds = YES;
- [self.view addSubview:bgV];
- [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(32.0f);
- make.right.offset(-32.0f);
- make.centerY.equalTo(self.view);
- }];
-
- UILabel *titleL = [[UILabel alloc] init];
- titleL.font = LCFont(19.0f);
- titleL.textColor = [UIColor whiteColor];
- titleL.textAlignment = NSTextAlignmentCenter;
- titleL.text = @"直播管理条例";
- [bgV addSubview:titleL];
- [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(20.0f);
- make.left.offset(14.0f);
- make.right.offset(-14.0f);
- }];
-
-
- //创建网页配置对象
- WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
- WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:config];
- webView.backgroundColor = HexColorFromRGB(0x2A2935);
- webView.UIDelegate = self;
- // 导航代理
- webView.navigationDelegate = self;
- webView.allowsBackForwardNavigationGestures = NO;
- NSString *protocolAddress = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,LiveProtocolH5];
- [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:protocolAddress]]];
- [bgV addSubview:webView];
- [webView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(14.0f);
- make.right.offset(-14.0f);
- make.top.equalTo(titleL.mas_bottom).offset(20.0f);
- make.height.offset(263.0f);
- }];
-
- CGFloat width = (KScreenWidth-90.0f-15.0f) / 2.0f;
- UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- cancelBtn.layer.cornerRadius = 5.0f;
- cancelBtn.clipsToBounds = YES;
- cancelBtn.backgroundColor = HexColorFromRGB(0x9F9DA5);
- [cancelBtn setTitle:@"不同意" forState:UIControlStateNormal];
- [cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- cancelBtn.titleLabel.font = LCFont17;
- [cancelBtn addTarget:self action:@selector(youpaifcancelBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [bgV addSubview:cancelBtn];
- [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(14.0f);
- make.top.equalTo(webView.mas_bottom).offset(20.0f);
- make.size.mas_offset(CGSizeMake(width, 48.0f));
- make.bottom.offset(-20.0f);
- }];
-
- UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- confirmBtn.layer.cornerRadius = 5.0f;
- confirmBtn.clipsToBounds = YES;
- [confirmBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(width, 48.0f) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- [confirmBtn setTitle:@"开启直播" forState:UIControlStateNormal];
- [confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- confirmBtn.titleLabel.font = LCFont17;
- [confirmBtn addTarget:self action:@selector(youpaifconfirmBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [bgV addSubview:confirmBtn];
- [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-14.0f);
- make.size.mas_offset(CGSizeMake(width, 48.0f));
- make.bottom.offset(-20.0f);
- }];
- }
- - (void)youpaifcancelBtnClick{
- [self dismissViewControllerAnimated:YES completion:^{
- if (self.youpaipagreeStartLiveBlock != nil) {
- self.youpaipagreeStartLiveBlock(NO);
- }
- }];
- }
- - (void)youpaifconfirmBtnClick{
- [self dismissViewControllerAnimated:YES completion:^{
- if (self.youpaipagreeStartLiveBlock != nil) {
- self.youpaipagreeStartLiveBlock(YES);
- }
- }];
- }
- @end
|