ここでこれに関する3つまたは4つの投稿を試しましたが、ファイルパスを使用するものはなく、WKWebViewでこれを機能させることができません。UIWebViewで機能します。誰か助けてください。はい、私はこれに非常に慣れていません。今夜ここに投稿する前に一日中試したので、わかりやすい指示は素晴らしいでしょう. ありがとう。
.h ファイル:
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIWebView *contentWebView;
@end
.m ファイル:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize contentWebView;
- (void)viewDidLoad {
[super viewDidLoad];
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"LockBackground" ofType:@"html"];
NSURL * fileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];
NSURLRequest * myNSURLRequest = [[NSURLRequest alloc]initWithURL:fileURL];
[contentWebView loadRequest:myNSURLRequest];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end