Develop
2015.02.10 18:41
[ios] UIWebView에서 로컬에 있는 html 파일 불러오기
조회 수 966 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
841 | Develop | 프로그램 문서 관리 (Doxygen) | hooni | 2013.04.23 | 16430 |
840 | Develop |
프로그래밍에서 foo, bar 함수의 유래
![]() |
hooni | 2013.06.25 | 21402 |
839 | Develop | 프로그래밍 소스 관련 사이트.. | hooni | 2013.04.23 | 16517 |
838 | Develop |
페이팔에서 돈 찾기 (Paypal withdraw)
![]() |
hooni | 2014.02.20 | 11460 |
837 | Develop |
캘리포니아 운전면허 족보
![]() |
hooni | 2017.06.12 | 857 |
836 | Develop |
최근 논문 자료 (2011/01/03, 만현형한테 보낸거..)
![]() |
hooni | 2013.04.23 | 10366 |
835 | Develop |
참고하고 지울 자료.. 집에서 바야지.. ㅋㅋ
![]() |
hooni | 2013.04.23 | 12157 |
834 | Develop |
정리할 자료.
![]() |
hooni | 2015.07.02 | 809 |
833 | Develop | 자주 쓰는 Docker 명령어 alias | hooni | 2020.01.10 | 270750 |
832 | Develop |
이어서 작업할 내용~
![]() |
hooni | 2013.11.21 | 0 |
831 | Develop | 웹페이지 성능 테스트 툴 설명 | hooni | 2013.04.23 | 27507 |
830 | Develop |
알고리즘 성능분석
![]() |
hooni | 2014.06.24 | 3068 |