在.h文件当中先进行声明
@property (strong ,nonatomic)UILabel *label;
@property (strong ,nonatomic)UIButton *button;
在.m文件当中进行实现
self.label.text=@"HELLO WORLD";
self.label=[[UILabel alloc] initwithFrame: CGRectMake(0,0,0,0,0)];
[self.label settitlecolor :[UIColor redColor] forState :UIControlStateNormal];
self.label setTitle;@“button”forState:UIConttrolStateNormal];
[self.Button addTarget:self action :@selector(clicked)forcontrolEvents:UIControlEventTouchUpInside];//这个是button里面的在label里面没有
[self.view addSubview:self];
//创建botton和label一样就不写了、
-(void)Clicked{
}