2011-03-24 33 views
0

在我viewControllerOne ,,,我使用tableview..and当我点击任何row..I现在用这个code..to导航到另一个页面......此代码显示文本而不是图片所需的更改是什么?

  Feches *rOVc = [[Feches alloc] initWithNibName:@"Feches" bundle:nil];  
      rOVc.hidesBottomBarWhenPushed = YES; 
      rOVc.title = [NSString stringWithFormat:@"15 March 2011"]; 
      rOVc.strURL = [[NSString alloc] initWithString:[[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"first_screen" ofType:@"png"]] absoluteString]]; 
      [self.navigationController pushViewController:rOVc animated:YES]; 
      [rOVc release]; 

现在,当它定位到Feches ...

在其获取的viewDidLoad我使用此代码...

NSString *html = [NSString stringWithFormat:@"<html><head>\ 
        <meta id='viewport' name='viewport' content='minimum-scale=0.2; maximum-scale=5; user-scalable=1;' />\ 
        </head><body style=\"margin:0\"><img id=\"yt\" src=\"%@\"></body></html>", self.strURL]; 

NSLog(@"html:%@",html); 
// Load the html into the webview 
if(self.myWeb == nil) { 
    self.myWeb = [[UIWebView alloc] initWithFrame:self.view.frame]; 
    [self.view addSubview:self.myWeb]; 
} 
[self.myWeb loadHTMLString:html baseURL:[NSURL URLWithString:self.strURL]]; 

这是显示我的名字命名的图片first_screen这是有以米y images images folder ...

现在...我想使用文本段落而不是图片...但是使用相同种类的html和所有这些...任何人都可以请建议我,我必须做些什么改变现在用于显示段落而不是图像?

回答

1

更改您的html字符串内容。将<img id=...>替换为<p>text</p>

你在泄漏UIWebView(如果self.myWeb保留)。将您的代码更改为:

self.myWeb = [[[UIWebView alloc] initWithFrame:self.view.frame] autorelease]; 
self.myWeb = [[[UIWebView alloc] initWithFrame:self.view.frame] autorelease]; 
+0

..好吧,如果我想在此Web视图中显示“blah blah blah”这样的文本,我应该更改哪些内容...? – 2011-03-24 13:29:15

+0

正如我写的,用P标签替换IMG标签,并将这两个P标签之间的文本。 – robertvojta 2011-03-24 13:33:02

相关问题