2009-11-19 76 views
0

我正在使用「loadHTMLString」創建一個webview和加載內容內容正在加載我只是無法讓鏈接工作,因爲鏈接到google.com。任何幫助都會很棒。帶鏈接的UIWebView

UIWebView* newWeb = [[UIWebView alloc initWithFrame:CGRectMake(notificationPopUp.frame.origin.x+ 20,notificationPopUp.frame.origin.y-100,100, 100)]; 
//newWeb.backgroundColor = [UIColor clearColor]; 
newWeb.alpha = 0.7; 
newWeb.opaque= NO; 
newWeb.delegate= self; 
NSString *html = [NSString stringWithFormat:@"<html><head><title></title><style type=\"text/css\">a{text-decoration:none}</style></head><body><FONT COLOR=\"#484848\"><p>Hello this is a <a href=\"http://www.google.com\">Test</a></p></FONT></body></html>"]; 
[newWeb loadHTMLString:html baseURL:[NSURL URLWithString:@""]]; 
newWeb.userInteractionEnabled= TRUE; 
[notificationPopUp addSubview:newWeb]; 
+0

鏈接是否指向存儲在應用程序捆綁中的資源? – 2009-11-19 21:46:31

+0

關於a)您期望鏈接所做的事情和b)您對目前所做事情的觀察將有所幫助。 – fbrereto 2009-11-19 21:51:39

+0

在這個例子中我只是想去谷歌。主要是我只想鏈接到網站。 – wolffang 2009-11-19 22:04:19

回答

0

我將此代碼添加到一個空的項目中,鏈接是可點擊的。我唯一能想到的是你的notificationPopUp視圖是以某種方式防止點擊進入web視圖。

+0

感謝您縮小它,找不到彈出框的工作,然後 – wolffang 2009-11-20 14:25:24

+0

是的,我將webview添加到按鈕,可能沒有收到任何接觸。將其更改爲將其添加到mainview的位置。 – wolffang 2009-11-22 22:31:24