I have a viewcontroller with with a xib file. The file needs to have a TextField and a Button that leads to another viewcontroller with a web view. I want to have the URL be altered by whatever the user enters into the text field. So for example:
URL in WebView: http://www.google.com/ user enter football into text field New Url in WebView: http://www.google.com/football
Any help would really be appreciated i already have my "main page" leading to a webview i just need to know what code needs to go were to alter the url.
Thanks in advance. If code is need i can post it
You could use string literals to pass the text of the box to the webview. Like this:
NSString *stringToPass = [NSString stringWithFormat:@"www.google.com/%@", self.textField.text];
Then, use a custom init method to pass your string to the new view:
self.viewController = [ViewController alloc]initWithAddress:stringToPass];
Make sure to declare -(id)initWithAddress:(NSString*)address; in the .h.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With