このブラウザにページ送りと戻りをつけたいのですがどのようにすればいいのでしょうか。
他のアプリではサイトを開くごとにMutableArray等にURLを保存したりしているのでしょうか。
良く分からないのですがアドバイスを頂けないでしょうか。
参考にしたサイト 一例
http://d.hatena.ne.jp/ppmp451z/20081028/1225209322
ソース
//
// WebViewController.h
//
#import <UIKit/UIKit.h>
@interface WebViewController : UIViewController {
UIWebView *webView;
NSString *link;
}
- (void)setURL:(NSString*)URL;
@property(nonatomic, retain)NSString *link;
@end
//
// WebViewController.m
//
#import "WebViewController.h"
@implementation WebViewController
@synthesize link;
- (void)setURL:(NSString*)URL{
link = [[NSString alloc] initWithFormat:@"%@",URL];
}
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
webView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[webView loadRequest:[[NSMutableURLRequest requestWithURL:
[NSURL URLWithString:link] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0] retain]];
webView.scalesPageToFit = YES;
self.view = webView;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[webView release];
[link release];
[super dealloc];
}
@end