myBrowserViewController.h
#import <UIKit/UIKit.h>
@interface myBrowserViewController : UIViewController {
IBOutlet UIWebView *mainView;
IBOutlet UITextField * webAddress;
}
@property(nonatomic, retain)UIWebView *mainView;
-(IBAction)Jump;
-(IBAction)backHome:(id)sender;
@end
myBrowserViewController.m
#import "myBrowserViewController.h"
@implementation myBrowserViewController
@synthesize mainView;
-(IBAction)Jump{
[mainView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[webAddress text]]]];
}
-(IBAction)backHome:(id)sender{
[mainView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
}
- (void)viewDidLoad {
[super viewDidLoad];[mainView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
}
- (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 {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end
参考
YouTube - XCode Tutorial: Programming A UIWebView
http://www.youtube.com/watch?v=yICZb91Poxs&hd=1
YouTube - iPhone SDK Tutorial - Internet Browser (WIth Search Bar!)
http://www.youtube.com/watch?v=Vpq8r-HHwZA&hd=1



0 コメント:
コメントを投稿