2012-02-21 30 views

回答

1

首先,你的表视图

textView.text = @"Search using web"; 
textView.dataDetectorTypes = UIDataDetectorTypeLink; 

公开赛上的Safari中使用此代码的每一行中添加的UITextView ....

NSURL *url = [ [ NSURL alloc ] initWithString: @"http://www.google.com" ]; 
[[UIApplication sharedApplication] openURL:url]; 
[url release]; 

任何帮助使用本IOS Refernce

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.. 
    } 
} 
相关问题