I’m modifying some code that I’ve been left with and want to add some funcationality to this app. I have a table view and on the didSelectRowAtIndexPath event, I am just loading a controller that has a UIWebView. Like this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
WebViewController *webViewController = [[WebViewController alloc]
initWithNibName:@"WebViewController" bundle:nil];
What I really want to do is pass in a url to load as I just have hardcoded the url to load the viewDidLoad like this:
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = NSLocalizedString(@"WebTitle", @"");
CGRect webFrame = [[UIScreen mainScreen] applicationFrame];
webFrame.origin.y=0;
self.myWebView = [[UIWebView alloc] initWithFrame:webFrame];
self.myWebView.backgroundColor = [UIColor whiteColor];
self.myWebView.scalesPageToFit = YES;
self.myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
self.myWebView.delegate = self;
[self.view addSubview:self.myWebView];
[self.myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://stackoverflow.com/"]]];
What is the easiest way to pass the url for stackoverflow.com in the instantiation of the WebViewController?
thx
make a property url in .h file then assign that property as