Develop
2015.02.10 18:41
[ios] UIWebView에서 로컬에 있는 html 파일 불러오기
Views 970 Comment 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
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
793 | Develop |
[lego] 세그웨이 이것만 볼것.. ㅎㅎ
![]() |
hooni | 2013.04.23 | 33574 |
792 | Develop |
[c] C로 구현한 CGI - 방명록
![]() |
hooni | 2003.04.23 | 33504 |
791 | Develop |
베지어 곡선(Bézier curve) 알고리즘(spline 곡선)
3 ![]() |
hooni | 2013.04.23 | 33396 |
790 | Develop | [js] jQuery 코드 작성시 편리한 HTML 템플릿 | hooni | 2013.12.17 | 33112 |
789 | Develop |
[c++] 웹폼(webform)전송과 http 파일 업로드 샘플
![]() |
hooni | 2013.04.23 | 33106 |
788 | Develop | [ios] 디렉토리 하하하.. | hooni | 2013.04.23 | 32655 |
787 | Develop | [js] 키보드 아스키코드(ASCII) 코드보기 | hooni | 2003.04.23 | 32503 |
786 | Develop |
[c] C로 구현한 CGI - 달력과 날짜계산기
![]() |
hooni | 2003.04.23 | 32438 |
785 | Develop | [ios] 개발 기초 가이드 링크.. | hooni | 2013.04.23 | 31416 |
784 | Develop |
[js] jQuery 관련 문서 ㅎㅎ
![]() |
hooni | 2013.04.23 | 31253 |
783 | Develop | [android] 디바이스(시뮬레이터) hosts 파일 수정하기 | hooni | 2013.04.23 | 31119 |
782 | Develop | 서기의 PHP 동영상 강의(싱싱해) | hooni | 2013.05.15 | 31042 |