我有一个UIWebView,我希望当用户访问其中的链接时,他们可以在这里返回我的webview代码
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 430)]; // x is width,y is hght
NSString *urlAddress = @"http://livewiretech.co.nf/ NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
[self.view addSubview:webView];
我有一个UIButton,它的代码是
-(void) backButtonPressed {
//Back code here
}
答案 0 :(得分:1)
这样的事情应该让你去
@property (nonatomic, strong) UIWebView * webView;
....
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 430)]; // x is width,y is hght
NSString *urlAddress = @"http://livewiretech.co.nf/";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
[self.view addSubview:webView];
-(void) backButtonPressed {
if ([webView canGoBack]) {
[webView goBack];
}
}