标签:
1 UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 2 signBtn.frame = CGRectMake(0, 0, 80, 40); 3 [signBtn.layer setMasksToBounds:YES]; 4 [signBtn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径 5 [signBtn.layer setBorderWidth:1.0]; //边框宽度 6 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 7 CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 1, 0, 0, 1 }); 8 [signBtn.layer setBorderColor:colorref];//边框颜色 9 [signBtn setTitle:@"还 原" forState:UIControlStateNormal];//button title 10 [signBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];//title color 11 [signBtn addTarget:self action:@selector(buttonDonwRecover:) forControlEvents:UIControlEventTouchUpInside];//button 点击回调方法 12 signBtn.backgroundColor = [UIColor whiteColor];
iOS开发--UIButton 设置圆角 边框颜色 点击回调方法
标签:
原文地址:http://www.cnblogs.com/feiling/p/4716078.html