18
UIWebView에 로컬 html 파일을로드하는 방법
UIWebView에 html 파일을로드하려고하는데 작동하지 않습니다. 단계는 다음과 같습니다. 프로젝트에 html_files라는 폴더가 있습니다. 그런 다음 인터페이스 빌더에서 webView를 작성하고 viewController에서 콘센트를 지정했습니다. 이것은 html 파일을 추가하는 데 사용하는 코드입니다. -(void)viewDidLoad { NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"html" inDirectory:@"html_files"]; NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile]; [webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]]; [super …