//
// ViewController.m
// webAPP
//
// Created by apple on 14-7-8.
// Copyright (c) 2014年 apple. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIWebView *webview;
@property (weak, nonatomic) IBOutlet UITextField *textField;
@end
@implementation ViewController
- (IBAction)didGo:(id)sender {
NSString *str = _textField.text;
if (![str hasPrefix:@"http://"]) {
str = [NSString stringWithFormat:@"http://%@", str];
}
NSURL *url = [NSURL URLWithString:str];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webview loadRequest: request];
}
- (IBAction)foward:(id)sender {
[self.webview goForward];
}
- (IBAction)goback:(id)sender {
[self.webview goBack];
}
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *url = [NSURL URLWithString: @"http://www.baidu.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webview loadRequest:request];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
// ViewController.m
// webAPP
//
// Created by apple on 14-7-8.
// Copyright (c) 2014年 apple. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIWebView *webview;
@property (weak, nonatomic) IBOutlet UITextField *textField;
@end
@implementation ViewController
- (IBAction)didGo:(id)sender {
NSString *str = _textField.text;
if (![str hasPrefix:@"http://"]) {
str = [NSString stringWithFormat:@"http://%@", str];
}
NSURL *url = [NSURL URLWithString:str];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webview loadRequest: request];
}
- (IBAction)foward:(id)sender {
[self.webview goForward];
}
- (IBAction)goback:(id)sender {
[self.webview goBack];
}
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *url = [NSURL URLWithString: @"http://www.baidu.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webview loadRequest:request];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end