【发布时间】:2011-12-08 22:13:12
【问题描述】:
我正在制作一个包含最新公司新闻部分的应用程序。基本上,该计划最初是使用 ASIHTTPRequest 来提取所有 HTML,在其中搜索标签,然后将信息提取出来以获取新闻标题和描述,然后在我的应用程序的滚动视图中将其显示为计划文本。然而,这被证明是一场噩梦,因为该网站的信息显示方式没有模式。
我决定在 UIWebView 中显示 URL,它显示最新的公司新闻。我希望这是一个单页视图,因此我的用户无法导航到网站的其他方面。是否可以阻止网站超链接显示为链接?我的 UIWebView 代码如下;
UIView *webNewsView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
self.view = webNewsView;
CGRect webFrame = [[UIScreen mainScreen] applicationFrame];
webFrame.origin.y = 0.0f;
webNews = [[UIWebView alloc] initWithFrame:webFrame];
webNews.backgroundColor = [UIColor clearColor];
webNews.scalesPageToFit = YES;
webNews.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
webNews.delegate = self;
[self.view addSubview: webNews];
[webNews loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://myURLHere"]]];
indicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
indicator.frame = CGRectMake(0.0, 0.0, 25.0, 25.0);
indicator.center = self.view.center;
[self.view addSubview: indicator];
任何帮助将不胜感激。 谢谢
编辑:我也尝试添加以下内容;
webNews.dataDetectorTypes = UIDataDetectorTypeNone;
这对链接的检测没有影响。
【问题讨论】:
标签: iphone objective-c ios4 uiwebview