开发者

what is the change required in this code to show text instead of image?

In My viewControllerOne,,,I am using tableview..and when I tap any row..I am using this code..to navigate to another page...

            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:r开发者_StackOverflowOVc animated:YES];
            [rOVc release];

Now When It navigate to Feches...

In that fetches's viewdidload I am using this code...

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]];

This is showing me image named...first_screen which is there in my images folder...

Now...I want to use text paragraph instead of image ...but with the same kind of html and all this..can anyone please suggest me what change do I have to do now for showing paragraphs instead of an Image??


Change your html string content. Replace <img id=...> with <p>text</p>.

You're leaking UIWebView (if self.myWeb retains). Change your code to:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜