ios-unity/Classes_cocos/WebPageViewController.m
2023-03-20 13:44:30 +08:00

45 lines
1.1 KiB
Objective-C

//
// WebPageViewController.m
// Unity-iPhone
//
// Created by Hl Zhang on 2023/3/14.
//
#import "WebPageViewController.h"
#import <WebKit/WebKit.h>
#define SCREENWIDTH [UIScreen mainScreen].bounds.size.width
#define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height
@interface WebPageViewController ()
@property (nonatomic, strong) WKWebView *webView;
@end
@implementation WebPageViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Create the WKWebView
self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:self.webView];
// Load the URL
NSURL *url = [NSURL URLWithString:self.url];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end