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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
561 | Develop |
[c] 숫자(int, Number)를 hex코드로 변환하는 소스
![]() |
hooni | 2013.04.23 | 8129 |
560 | Develop | [c] 반올림 함수!! ㅋㅋ | hooni | 2003.04.23 | 8121 |
559 | Develop |
[c] 레포트용으로 제출했던 여러 소스코드 모음
![]() |
hooni | 2003.04.23 | 8111 |
558 | Develop |
[c] 유닉스 프로그램에서 인수처리 해주는 getopt() 함수
![]() |
hooni | 2013.04.23 | 8082 |
557 | Develop |
[js] 셀렉트박스(select)의 옵션(option) 동적으로 추가/제거
![]() |
hooni | 2013.04.23 | 8074 |
556 | Develop |
[c] 구구단 최단라인 ㅡㅡ;
![]() |
hooni | 2013.04.23 | 8042 |
555 | Develop | [c] 프로세스 검사하기 | hooni | 2013.04.23 | 8037 |
554 | Develop | [c] 포인터와 함수포인터에 대해.. | hooni | 2003.04.23 | 8037 |
553 | Develop | [c] Unix Domain Socket 을 이용한 IPC | hooni | 2013.04.23 | 8031 |
552 | Develop | [java] RGB코드를 HEX코드로 변환하는 코드 ㅎㅎ | hooni | 2013.04.23 | 8018 |
551 | Develop |
논문에 들어갈 툴바 테스트 해볼 것..
![]() |
hooni | 2013.04.23 | 8013 |
550 | Develop |
[c] 자료구조 그래프(graph) 소스코드 - 확인해볼 것..
![]() |
hooni | 2013.04.23 | 8008 |