UIButton*button=[UIButton buttonWithType:UIButtonTypeCustom];
button.frame=CGRectMake(100, 100, 100, 100);
button.layer.cornerRadius=30;
button.backgroundColor=[UIColor grayColor];
button.layer.borderWidth=8;//设置边框的宽度
button.layer.borderColor=[[UIColor redColor]CGColor];//设置边框的颜色
button.clipsToBounds=YES;
[self.view addSubview:button];