覆盖羽声

This commit is contained in:
启星
2025-10-20 09:43:10 +08:00
parent affed1af58
commit 0d82f9e0ef
1331 changed files with 43209 additions and 14707 deletions

View File

@@ -0,0 +1,134 @@
//
// QXSkyPraizeRuleView.m
// QXLive
//
// Created by on 2025/8/26.
//
#import "QXSkyPraizeRuleView.h"
#import <WebKit/WebKit.h>
static void *WKWebBrowserContext = &WKWebBrowserContext;
@interface QXSkyPraizeRuleView()<WKNavigationDelegate,WKUIDelegate,UIGestureRecognizerDelegate>
@property(nonatomic,strong)WKWebView *contentWebView;
@property(nonatomic,strong)UIView* bgView;
@property(nonatomic,strong)UIImageView* ruleImageView;
@property(nonatomic,strong)UIImageView* bgImageView;
@end
@implementation QXSkyPraizeRuleView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
tap.delegate = self;
[self addGestureRecognizer:tap];
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663))];
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
[self addSubview:self.bgView];
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sky_rule_bg"]];
self.bgImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(663));
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self.bgView addSubview:self.bgImageView];
self.ruleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sky_rule_icon"]];
self.ruleImageView.contentMode = UIViewContentModeScaleToFill;
self.ruleImageView.frame = CGRectMake((SCREEN_WIDTH-ScaleWidth(164))/2, 0, ScaleWidth(164), ScaleWidth(90));
[self.bgView addSubview:self.ruleImageView];
[self.bgView addSubview:self.contentWebView];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self;
}
-(void)setRule:(NSString *)rule{
_rule = rule;
[self loadData];
}
- (void)loadData {
NSURL* url=[NSURL URLWithString:self.rule];
NSURLRequest *request =[NSURLRequest requestWithURL:url];
[self.contentWebView loadRequest:request];
}
//
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView {
}
#pragma mark - getters and setters
- (WKWebView *)contentWebView {
if (!_contentWebView) {
//
WKWebViewConfiguration * configuration = [[WKWebViewConfiguration alloc]init];
//
configuration.selectionGranularity = YES;
// webpr
configuration.processPool = [[WKProcessPool alloc] init];
//, jsoc(OCURL)
WKUserContentController * UserContentController = [[WKUserContentController alloc]init];
//
configuration.suppressesIncrementalRendering = NO;
//
configuration.preferences.javaScriptEnabled = YES;
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
configuration.userContentController = UserContentController;
// iOS9iOS8
if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
//
configuration.allowsAirPlayForMediaPlayback = YES;
// 线
configuration.allowsInlineMediaPlayback = YES;
// NOios8
_contentWebView.allowsBackForwardNavigationGestures = YES;
}
_contentWebView = [[WKWebView alloc] initWithFrame:CGRectMake(16, self.ruleImageView.bottom+12, self.width-16*2, self.bgView.height-self.ruleImageView.bottom-12) configuration:configuration];
_contentWebView.backgroundColor = RGB16A(0x000000, 0.5);
[_contentWebView addRoundedCornersWithRadius:6];
_contentWebView.opaque = NO;
//
[_contentWebView sizeToFit];
_contentWebView.scrollView.showsVerticalScrollIndicator = NO;
_contentWebView.scrollView.backgroundColor = [UIColor clearColor];
_contentWebView.scrollView.bounces = NO;
//
_contentWebView.navigationDelegate = self;
}
return _contentWebView;
}
-(void)showInView:(UIView *)view{
self.bgView.y = SCREEN_HEIGHT;
[view addSubview:self];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(663);
}];
}
-(void)hide{
// [self stopSlowAnimate];
[UIView animateWithDuration:0.3 animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end