因此,我使用下面的代码检查字符串是否以“http://”开头,然后我想添加“http://”以便能够在UIWebView
.
NSString *firstString = [NSString stringWithFormat:@"%@", URL.text];
NSString *check = [NSString stringWithFormat:@"%@", @"http://"];
if (firstString != check) {
NSString *newString = [NSString stringWithFormat:@"http://%@", URL.text];
newString = [newString substringWithRange:NSMakeRange(7, newString.length - 7)];
URL.text = newString;
}
[WebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:URL.text]]];`
由于某种原因,这不起作用。你知道为什么吗?