//
// ViewController.m
// helloworld
//
// Created by apple on 14-7-8.
// Copyright (c) 2014年 戴维营教育. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@property (weak, nonatomic) IBOutlet UILabel *label;
@property (weak, nonatomic) IBOutlet UITextField *textField;
@end
//点击按钮改变label的内容
@implementation ViewController
- (IBAction)clicked:(id)sender {
//printf ("hello,clicked\n");
[email protected]"点击!";
}
//点击按钮把文本控件中的内容输到label中
- (IBAction)clickText:(id)sender {
self.label.text=self.textField.text;
}
//网页浏览
- (IBAction)click3:(id)sender {
//生成网址
NSURL *url=[NSURL URLWithString:@"http://www.baidu.com"];
//网址请求
NSURLRequest *request=[NSURLRequest requestWithURL:url];
//网页加载
[self.webView loadRequest:request];
}
- (IBAction)segment:(UISegmentedControl *)sender {
printf("segment:%d",sender.selectedSegmentIndex);
}
//滑块变得输出滑块的程度
- (IBAction)slider:(id)sender {
UISlider *slide=(UISlider *)sender;
NSLog(@"slide:%f",slide.value);
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
控件初识