//
//  MyviewViewController.h
//  XibDemo
//
//  Created by hehe on 15/9/21.
//  Copyright (c) 2015年 wang.hehe. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface MyviewViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIButton *Go;

- (IBAction)onclic:(id)sender;

@property (weak, nonatomic) IBOutlet UITextField *textfield1;

@property (weak, nonatomic) IBOutlet UIWebView *web;
@end

//
//  MyviewViewController.m
//  XibDemo
//
//  Created by hehe on 15/9/21.
//  Copyright (c) 2015年 wang.hehe. All rights reserved.
//

#import "MyviewViewController.h"

@interface MyviewViewController ()

@end

@implementation MyviewViewController

- (void)viewDidLoad {
    [super viewDidLoad];

}

- (IBAction)onclic:(id)sender {
    
    NSURL *url = [NSURL URLWithString:_textfield1.text];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    
    [_web loadRequest:request];
    
    [_textfield1 resignFirstResponder];
}
@end

//在appdelegate中的代码

//
//  AppDelegate.m
//  XibDemo
//
//  Created by qianfeng on 15/9/21.
//  Copyright (c) 2015年 qianfeng. All rights reserved.
//

#import "AppDelegate.h"
#import "MyviewViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds] ];
    self.window.backgroundColor = [UIColor whiteColor];
    
    //    ViewController *vc = [[ViewController alloc]init];
    MyviewViewController *vc = [[MyviewViewController alloc] initWithNibName:@"MyviewViewController" bundle:nil];
    
    self.window.rootViewController = vc;
    [self.window makeKeyAndVisible];
    
    return YES;
}

@end

XibDemo的更多相关文章

  1. iOS Xib布局某些控件显示或隐藏<约束的修改>

    对于这个问题使用Masonry是很好解决的. 注意:绿色的是label2,当indexpath.section % 2 == 0时,label2不存在. 关键代码如下: if (indexPath.s ...

随机推荐

  1. Codeforces Round #311 (Div. 2) C. Arthur and Table Multiset

    C. Arthur and Table Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/p ...

  2. Codeforces Round #310 (Div. 1) B. Case of Fugitive set

    B. Case of Fugitive Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/555/p ...

  3. C# 的时间戳转换

    /// <summary> /// 时间戳转为C#格式时间 /// </summary> /// <param name="timeStamp"> ...

  4. [Angular2 Router] Exiting an Angular 2 Route - How To Prevent Memory Leaks

    In this tutorial we are going to learn how we can accidentally creating memory leaks in our applicat ...

  5. Servlet 3.0 新特性

    Servlet 3.0 作为 Java EE 6 规范体系中一员,随着 Java EE 6 规范一起发布.该版本在前一版本(Servlet 2.5)的基础上提供了若干新特性用于简化 Web 应用的开发 ...

  6. HDOJ 1301 Jungle Roads

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1301 //HDOJ1301 #include<iostream>#include<c ...

  7. 使用jmeter对ActiveMQ集群性能方案进行评估--转载

    原文地址:http://www.51testing.com/html/78/23978-143163.html 1.测试概要1.1 关于这篇文档中涉及的基于JMS的消息系统能为应用程序提供可靠的,高性 ...

  8. java中set和get方法的理解

    对于JAVA初学者来说,set和get这两个方法似乎已经很熟悉了,这两个方法是JAVA变成中的基本用法,也是出现频率相当高的两个方法. 为了让JAVA初学者能更好的理解这两个方法的使用和意义,今天笔者 ...

  9. C#操作串口总结

    Technorati 标签: C#,SerialPort,ReadTo,ReadTimeout        最近几天一直在调一个要长时间连续不断的操作串口,并且是多线程运行,不允许中断的服务.后来服 ...

  10. 【Java/Android性能优2】Android性能调优工具TraceView介绍

    本文参考:http://www.trinea.cn/android/android-traceview/ Android自带的TraceView堪比java的性能调优工具visualvm线程视图,可以 ...