Develop
2015.02.10 18:41
[ios] UIWebView에서 로컬에 있는 html 파일 불러오기
조회 수 978 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
361 | Develop |
[js] 빈도우즈(bindows96)
![]() |
hooni | 2013.04.23 | 7396 |
360 | Develop |
[c] 스택/힙 오버플로우 테스트(overflow)
![]() |
hooni | 2003.04.23 | 7391 |
359 | Develop | [c/c++] Makefile 사용하기.. ㅋㅋ | hooni | 2003.04.23 | 7389 |
358 | Develop |
[linux] 임베디드 리눅스 (embedded linux)
![]() |
hooni | 2013.04.23 | 7384 |
357 | Develop | [php] 이미지 회전시키기(gd) | hooni | 2013.04.23 | 7367 |
356 | Develop |
[jsp] 정적/동적(차트생성) 이미지 전달
![]() |
hooni | 2003.04.23 | 7343 |
355 | Develop | [js] 초간단 현재 사이트 쿠키 확인하는 명령~ | hooni | 2003.04.23 | 7342 |
354 | Develop |
객체지향 프로그래밍에 대한 개념.. (객체)
![]() |
hooni | 2013.04.23 | 7342 |
353 | Develop |
[c]디렉토리 탐색
![]() |
hooni | 2003.04.23 | 7339 |
352 | Develop |
[c] 플러드 필링 (flood filling) 알고리즘..
![]() |
hooni | 2013.04.23 | 7337 |
351 | Develop |
[pdf] C++ 국제 표준 문서
![]() |
hooni | 2013.04.23 | 7320 |
350 | Develop |
[c++] mfc로 만든 사용자 계정 리스트 출력(EnumUser) 프로그램 예제
![]() |
hooni | 2013.04.23 | 7320 |