I have an important question. I'm creating an iPhone app. I have an UIWebView (https://www.google.de/) with goBack, goForward and reload. Now, I want a Button e.g. Bar Button Item named Home or Homepage, to open an URL (https://www.google.de/) in this WebView, to go back to the homepage. How can I do this? How can I "say" the button to open the link in my WebView? I ask for answer.
// ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (nonatomic, strong) IBOutlet UIWebView *site ;
@end
// ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
-(IBAction)refresh:(id)sender; {
NSURL *url=[NSURL URLWithString: @"https://www.google.de/"]; NSURLRequest * requestURL=[NSURLRequest requestWithURL:url]; [_site loadRequest:requestURL];
}
- (void)viewDidLoad {
[self refresh:self];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end