#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *label;//拉Label
@property (weak, nonatomic) IBOutlet UIButton *button;//拉Button
@property (weak, nonatomic) IBOutlet UITextField *textField;//拉Text
@property (weak, nonatomic) IBOutlet UISegmentedControl *seg;//拉Seg
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.label.text= @"123";//设置label显示字符“123”
[self.button setTitle:@"点击" forState:UIControlStateNormal];//设置button显示为“点击”,属性为普通
[self.button addTarget:self action:@selector(didClickBtn:) forControlEvents:UIControlEventTouchUpInside];
//设置button响应 传递didClickBtn: 点击
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didClickBtn:(UIButton*)sender{
NSLog(@"点击了button 打印%@",sender);}
//自定义属性 点击button打印“@……” (sender:发送信息者。)
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated
}
@end
//@selector(didclickBtn:)
2018-07-21 13:51:42.232757+0800 10[3432:319062] 点击了button 打印>