Creating a browser

Source: Internet
Author: User

#import "ViewController.h"@interface ViewController ()<UIScrollViewDelegate>  //保包括这个viewdelegat协议          @property (weak, nonatomic) IBOutlet UITextField *search;   //这是输入框@property (weak, nonatomic) IBOutlet UIWebView *viewbrows; // 这个是浏览器界面视图@end@implementation ViewController- (void)viewDidLoad {    [super viewDidLoad];     //初始化载入    }- (IBAction)go:(id)sender {    NSString *path =self.search.text;   //字符串指针指向输入的文本    //[path stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)]//这个应该是转换代码格式            if (![path hasPrefix:@"http://"]) {        //表示判断path前缀是否是http://                                                             path=[@"http://" stringByAppendingString:path];        没有则添加http://在path前面    }                                                            NSURL *url =[NSURL URLWithString:path];             //用url指针指向字符串格式的url path         NSURLRequest *request =[NSURLRequest requestWithURL:url];   request请求指向url    [self.viewbrows loadRequest:request];                                   载入请求的url    [self.view endEditing:YES];                                //当使徒运行完成后键盘会缩回}- (IBAction)went:(id)sender {    [self.viewbrows goForward];          //前进}- (IBAction)back:(id)sender {    [self.viewbrows goBack];            //后退}- (void)didReceiveMemoryWarning {    [super didReceiveMemoryWarning];    // Dispose of any resources that can be recreated.}@end

 

Creating a browser

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.