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

댓글 없음:

댓글 쓰기

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

요즘 새로운 과정을 기획하면서 react.js + next.js를 OpenAI API와 같이 사용하는 과정을 만들고 있습니다. ㅎㅎ

 오랜만에 웹 기술들을 공부하니 재미있네요. ㅎㅎ  쭉 파이썬 과정들을 운영하고 있었는데 좀 더 범위를 넓혀서 아이폰 앱 개발과정 with ChatGPT,  웹 프로그래밍 with ChatGPT, AI시대의 AI어시스턴트 활용하기와 같은 글을 쓰고, ...