URL을 textview iphone에서 여는 방법 ??iPhone 앱에 HTML 표시
links
, photos
및 모두 html entities
으로 데이터를 표시 할 수 있습니까 ???
URL을 textview iphone에서 여는 방법 ??iPhone 앱에 HTML 표시
links
, photos
및 모두 html entities
으로 데이터를 표시 할 수 있습니까 ???
UITextView
컨트롤로는 불가능합니다. UIWebView
을 사용하거나 나만의 맞춤 컨트롤을 만드십시오.
UIWebView를 사용하여 파일에서 정적 포함을로드 할 수 있습니다. HTML, 사진, CSS, 자바 스크립트.
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
NSString *htmlString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[self.webView loadHTMLString:htmlString baseURL:baseURL];
"index.html"을 일반 HTML 표준으로 프로젝트에 추가하기 만하면됩니다.
<html>
<head><title>Hello</title></head>
<body>
<img src="icon.png"/>
<p>Test</p>
</body>
</html>
나는 어떤 마법도 볼 수 없다. – BoltClock
Jain : 왜 [UIWebView] (http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html)를 사용하지 않습니까? –
여기에 'UIWebView'를 사용하십시오. – cweinberger