티스토리 뷰
//그냥 바로 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];
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];
'나름 프로그래밍? > Objective-C' 카테고리의 다른 글
CATransition (0) | 2010.04.22 |
---|---|
UIImageView (0) | 2010.04.21 |
Objective-C 에서의 Singleton (2) | 2010.04.17 |
5. Views, Drawing, and Animation (January 19, 2010) (0) | 2010.04.09 |
4. Building an Application; Model, View, Controller; Nib Files; Controls and Target-Action (January 14, 2010) (0) | 2010.04.09 |