我有一個UIWebView加載鏈接,http://www.google.com/a/datacommsales.net。但我希望datacommsales.net部分可以互換。我希望它是http://www.google.com/a/stringOne,stringOne是NSString,所以我可以設置字符串的值並在不編輯代碼的情況下更改鏈接。但鏈接在引號內,@「http://www.google.com/a/datacommsales.net」,所以它不能識別字符串。我怎樣才能將字符串的值作爲鏈接的一部分?任何幫助表示讚賞。鏈接內的NSString
編輯
要成爲一個更具體一點,這裏是我的代碼:
- (IBAction)refreshNow:(id)sender
{
NSString *variablePart = @"secondpart.com";
NSString *page = [NSString stringWithFormat:@"google.com/a/variablePart/docs"];
[webView loadHTMLString:page baseURL:nil];
}
我將如何把字符串variablePart中的鏈接像那樣?
謝謝。那種我在找的東西。但要更具體一點,這裏是我的代碼: - (IBAction)refreshNow:(id)發件人 { \t \t NSString * variablePart = @「secondpart.com」; \t NSString * page = [NSString stringWithFormat:@「google.com/a/variablePart/docs」]; \t \t [webView loadHTMLString:page baseURL:nil]; 如何將字符串variablePart放入鏈接中? – potato 2010-03-14 00:51:28
謝謝!完善! – potato 2010-03-16 00:50:05