UIButton的实现(含有边框)

UIButton *reg = [UIButtonbuttonWithType:UIButtonTypeSystem];

reg.frame = CGRectMake((UISCREEN_WIDTH-280)/2mainView.frame.size.height-12028035);

reg.layer.masksToBounds = YES;

reg.layer.borderWidth = 1.0;//设置边框的宽度

reg.layer.borderColor = [[UIColor  colorWithRed:21/255.0 green:100/255.0  blue:249/255.0  alpha:1.0]CGColor];//设置边框的颜色

reg.layer.cornerRadius = 5.0;//设置边框的四个角的弧度

[reg setTitle:@"用户授权注册forState:UIControlStateNormal];

[reg setTitleColor:[UIColorcolorWithRed:21/255.0  green:100/255.0  blue:249/255.0  alpha:1.0forState:UIControlStateNormal];

reg.tag = 2;

[reg addTarget:self  action:@selector(gotoView:)  forControlEvents:UIControlEventTouchUpInside];

[mainView  addSubview:reg];


UIButton的实现(含有边框)_第1张图片

你可能感兴趣的:(iOS)