【问题标题】:How should I add a link at the bottom of the View in iPhone我应该如何在 iPhone 的视图底部添加一个链接
【发布时间】:2012-02-21 11:44:48
【问题描述】:

我有一个有 4 行的表格视图,在表格的表格视图页脚底部,我需要显示一个 URL 链接。它应该会打开相应的网页。

例如,我需要一个名为“Search using web”的链接,并且该链接应将视图带到http://www.google.com。我该如何实现?

【问题讨论】:

  • 你能显示你的截图吗?

标签: iphone objective-c xcode uitableview uiwebview


【解决方案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

【讨论】:

    【解决方案2】:

    使用标签显示“使用 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..   
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-21
      • 2018-03-05
      • 1970-01-01
      相关资源
      最近更新 更多