티스토리 뷰

//그냥 바로 html 문자열 보여주기

    NSString *htmlString;
    htmlString = [NSString stringWithFormat:@"%@", @"<html><body><img src=\"http://a1.twimg.com/profile_images/729315616/_____2010-03-03____4.22.09.png\"/><p>Test String</p></body></html>"];
   
    myWebView.opaque = NO;
    myWebView.backgroundColor = [UIColor clearColor];   
    [self.myWebView loadHTMLString:htmlString baseURL:nil];
    //웹상 URL을 읽어오려면
    [self.myWebView loadRequest:    [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.iphonedevsdk.com/forum/iphone-sdk-development/5573-cant-get-uiimageview-load-uiimage-runtime.html"]]];




//이건 예제 소스에 있는 로컬 파일에서 읽어오기
    NSString *path = [[NSBundle mainBundle] pathForResource:@"webViewContent" ofType:@"html"];
    NSFileHandle *readHandle = [NSFileHandle fileHandleForReadingAtPath:path];
           
    NSString *htmlString = [[NSString alloc] initWithData:
                              [readHandle readDataToEndOfFile] encoding:NSUTF8StringEncoding];
   
    // to make html content transparent to its parent view -
    // 1) set the webview's backgroundColor property to [UIColor clearColor]
    // 2) use the content in the html: <body style="background-color: transparent">
    // 3) opaque property set to NO
    //
    webView.opaque = NO;
    webView.backgroundColor = [UIColor clearColor];
    [self.webView loadHTMLString:htmlString baseURL:nil];
    [htmlString release];



공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함