I'm creating a simple web browser as an exercise.
-(IBAction)go:(id)sender {
NSString *query = [_urlField.text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@",query]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_webView loadRequest:request];
}
I would like it to know how I could add a UIActivityIndicator while loading my webView.
2nd question:
Is it possible to remove the http:// if the user enters it? I know you can do this in PHP like this:
if(strpos($URL, "http://") !== false)
How could I use it in Objective C?
Thanks you all for helping me.
For the first questions, check out this post.
And the second:
NSString* urlWithoutProtocol = [urlWithProtocol stringByReplacingOccurrencesOfString:@"http://" withString:@""];