基本上我正在尝试调用后退按钮以转到上一个网页,但它似乎无法这样做。我不确定我是否遗漏了一个小细节。当我在原始页面上单击一个链接然后单击另一个链接然后按下返回按钮以访问第一个链接时,这似乎有效,但不会返回到原始页面(希望这是有道理的)。
- (void)viewDidLoad {
[super viewDidLoad];
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 119, self.view.bounds.size.width, self.view.bounds.size.height - 165)];
webView.backgroundColor = [UIColor whiteColor];
webView.userInteractionEnabled = NO;
webView.opaque = NO;
[webView loadHTMLString:self.item.description baseURL:[NSURL URLWithString:self.item.link]];
[self.view addSubview:webView];
webView.delegate = self;
webView.scalesPageToFit = YES;
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
backButton.frame = CGRectMake(0, 0, 34, 34);
[backButton setImage:[UIImage imageNamed:@"back_arrow"] forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:backButton];
}
- (void)back {
[webView goBack];
}