I have 3 views that need to load web pages, I am doing the following ( with the associated connection and webview delegates ) in each of the views, is there a way to create a single source without duplicating the code in each view ? Most solutions I have found say to use asihttp but my company discourages 3rd party components. ( I'm still learning so be kind )
- (void)loadPage:(NSString*)urlString
{
NSURL *url = [NSURL URLWithString:urlString];
// Put that URL into an NSURLRequest
NSURLRequest *req = [NSURLRequest requestWithURL:url];
// NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:urlString]]];
// Create a connection that will exchange this request for data from the URL
connection = [[NSURLConnection alloc] initWithRequest:req
delegate:self
startImmediately:YES];
[self.webView loadRequest:req];
}