ios自定义button

来源:互联网 发布:怎么开启mysql服务 编辑:程序博客网 时间:2024/04/30 04:41

UIButton *btn=[[UIButton alloc]init];

btn.frame=CGRectMake(0,0,100,50);

[btn setTitle:@"back" forState:YES];

btn.backgroundColor=[UIColor redColor];

//点击事件的定义

[btn addTarget:self action:@selector(comper:) forControlEvents:UIControlEventTouchUpInside];

//调用的事件-(void)compre:(id)sender{

code;



}

0 0