2012-02-21 111 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.. 
    } 
} 
相關問題