39 lines
1.2 KiB
Objective-C
39 lines
1.2 KiB
Objective-C
//
|
|
// GameWebViewController.m
|
|
// ShenQi
|
|
//
|
|
// Created by Qwerdf on 2025/11/11.
|
|
//
|
|
|
|
#import "GameWebViewController.h"
|
|
|
|
@interface GameWebViewController ()<WKUIDelegate,WKNavigationDelegate>
|
|
|
|
@property (strong, nonatomic) WKWebView *webView;
|
|
@property (nonatomic,strong) WKUserContentController *wkUController;
|
|
|
|
@end
|
|
|
|
@implementation GameWebViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
|
|
WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init];
|
|
wkWebConfig.preferences.javaScriptCanOpenWindowsAutomatically = YES;
|
|
|
|
|
|
_wkUController = [[WKUserContentController alloc] init];
|
|
|
|
wkWebConfig.userContentController = _wkUController;
|
|
|
|
UIStatusBarManager *statusBarManager = [UIApplication sharedApplication].windows.lastObject.windowScene.statusBarManager;
|
|
_webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, statusBarManager.statusBarFrame.size.height, self.view.bounds.size.width, self.view.bounds.size.height-self.view.safeAreaInsets.bottom-statusBarManager.statusBarFrame.size.height) configuration:self.gameConfiguration];
|
|
_webView.UIDelegate = self;
|
|
_webView.navigationDelegate = self;
|
|
[self.view addSubview:_webView];
|
|
|
|
}
|
|
|
|
@end
|