2014년 11월 16일 일요일

아이폰 - 로컬에 있는 HTML 파일을 웹뷰에 출력하는 데모

아이폰 - 로컬에 있는 HTML 파일을 웹뷰에 출력하는 데모 조회 : 203
나의 폴더 > 아이폰 | 2012-12-13 (Thu) 14:04http://blog.dreamwiz.com/papasmf1/13911354
//
//  ViewController.h
//  demoWebView
//
//  Created by JONG DUK KIM on 12. 12. 12..
//  Copyright (c) 2012 JONG DUK KIM. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@property (strongnonatomicIBOutlet UIWebView *webView;

-(IBAction)goToHTML:(id)sender;

@end

//
//  ViewController.m
//  demoWebView
//
//  Created by JONG DUK KIM on 12. 12. 12..
//  Copyright (c) 2012 JONG DUK KIM. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
@synthesize webView;

-(IBAction)goToHTML:(id)sender
{
    //웹뷰로 html페이지를 로딩하는 코드
    //test1.html파일이면 아래와 같이 파일명을 기술해 주면
    //로딩된다
    NSError *error = nil;
    NSString *html = [[NSString alloc]
            initWithContentsOfFile:[[NSBundle mainBundle]
            pathForResource:@"test1" ofType:@"html"encoding:NSUTF8StringEncoding error:&error];
    [webView loadHTMLString:html baseURL:[NSURL URLWithString:[[NSBundle mainBundlepathForResource:@"test1" ofType:@"html"]]];
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

댓글 없음:

댓글 쓰기

참고: 블로그의 회원만 댓글을 작성할 수 있습니다.

인공지능 모델의 생태계를 정리해 주신 분이 계셔서 한번 올려봅니다.

 하루가 다르게 시장이 변하고 있어서 공부하기가 벅찹니다. ㅋㅋ