I am creating a webview that will contain different url's. So it will be random when you go to the webview. But i cant figure out how to do this. I looked at another question, and got it figured out kinda of. . This is the question i looked at, Random websites button I got it working in a webview, instead of safari. But i can't get the webview to work on another view controller now. It only works on the first view controller. I just need to get the webview to work on the other view cotroller. Not for sure if i need a global variable or what. Here is my code, so you can understand what i'm working with.
- (IBAction)site:(id)sender {
NSArray *urls = @[
[NSURL URLWithString:@"http://www.youtube.com"],
[NSURL URLWithString:@"http://www.twitter.com"],
[NSURL URLWithString:@"http;//www.yahoo.com"]
];
int index = arc4random_uniform(urls.count);
NSURL *randomURL = urls[index];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: randomURL];
[self.webView loadRequest:request];
please help, thanks!