gpt4 book ai didi

iphone - 要显示文本而不是图像,此代码需要进行哪些更改?

转载 作者:行者123 更新时间:2023-11-29 05:05:31 25 4
gpt4 key购买 nike

在我的 viewControllerOne 中,,,我正在使用 tableview..当我点击任何行时..我正在使用此代码..导航到另一个页面...

            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 的图像,该图像位于我的图像文件夹中...

现在...我想使用文本段落而不是图像...但是使用相同类型的 html 和所有这些...任何人都可以建议我现在必须做哪些更改才能显示段落而不是图片??

最佳答案

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

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

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

关于iphone - 要显示文本而不是图像,此代码需要进行哪些更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5419676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com