我有一个包含4行的表格视图,在表格底部的表格页脚中我需要显示一个URL链接。它应该打开相应的网页。
例如,我需要一个名为“Search using web”的链接,此链接应将视图转到http://www.google.com。我该如何实现呢?
答案 0 :(得分:1)
首先,在表格视图的每一行中添加UITextView
textView.text = @"Search using web";
textView.dataDetectorTypes = UIDataDetectorTypeLink;
Open on the safari使用此代码....
NSURL *url = [ [ NSURL alloc ] initWithString: @"http://www.google.com" ];
[[UIApplication sharedApplication] openURL:url];
[url release];
任何帮助都使用此IOS Refernce
答案 1 :(得分:0)
使用标签显示“使用Web搜索”文本。您还可以为文本加下划线。然后在标签的触摸事件上编写代码以打开链接。
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch= [touches anyObject];
if ([touch view] == your_labelName)
{
write your code here to open the url..
}
}