Develop
2015.02.10 18:41
[ios] UIWebView에서 로컬에 있는 html 파일 불러오기
조회 수 981 댓글 0
로컬에 있는 html 파일을 불러오는 방법!!
일단 웹뷰에서 보고자하는 html 파일을 프로젝트에 추가.
아래와 같은 코드로 로컬에 있는 html 파일을 읽어와서 웹뷰에 내용을 출력할 수 있다.
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(x, y, width, height)]; NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"파일명" ofType:@"html"]; NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile]; [webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURLURLWithString:@""]]; [self.view addSubview:webView];
-----------
팁!
webView에 라운드 주는 방법!
QuartzCore 프레임워크를 임포트하고 라운드 속성을 넣어준다.
#import <QuartzCore/QuartzCore.h> [[webView layer] setCornerRadius:10]; [webView setClipsToBounds:YES]; [[webView layer]setBorderColor: [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor]]; [[webView layer] setBorderWidth:2.75];
[출처] http://bananamilk.tistory.com/197
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
357 | Database | [mysql] 쓰레드가 계속 쌓이기 시작하고 사라지지 않을때.. | hooni | 2003.04.23 | 12860 |
356 | System/OS | [linux] 콘솔 기본언어 설정 방법 | hooni | 2013.04.23 | 12883 |
355 | System/OS | [linux] ProFTPD 타임아웃 설정 | hooni | 2003.04.23 | 12911 |
354 | System/OS | [sql] 내 방명록 답글 찾는 쿼리문.. (JOIN 구문) | hooni | 2003.04.23 | 12932 |
353 | Develop | [doc] UI개발시 유용한 소프트웨어 (개발 및 디버깅 툴) | hooni | 2013.04.23 | 12935 |
352 | Develop |
[c] 다중연결 서버 만들기 #1 - fork() 사용
![]() |
hooni | 2013.04.23 | 12949 |
351 | System/OS | [linux] 아파치 설치/설정(proxy) | hooni | 2003.04.23 | 13012 |
350 | System/OS | [router] 시스코 라우터 명령어 모드.. | hooni | 2013.04.23 | 13012 |
349 | Develop | [js] 자바스크립트의 클로저 (JavaScript's Closure) | hooni | 2013.05.15 | 13020 |
348 | Develop |
[php] 심플한 게시판 ㅋㅋ
1 ![]() |
hooni | 2013.04.23 | 13048 |
347 | Develop |
[js] AngularJS를 소개합니다.
![]() |
hooni | 2014.01.06 | 13054 |
346 | Develop | [html] 캐쉬된 웹페이지 사용하지 않도록 하는 방법 | hooni | 2003.04.23 | 13071 |