oc 圆角矩形

来源:互联网 发布:java开发和java实施 编辑:程序博客网 时间:2024/06/05 03:38

   设置一般情况和高亮状态的圆角显示

    self.loginBtn.frame =CGRectMake(loginBtnX, loginBtnY, loginBtnW, loginBtnH);

    [self.loginBtn.layersetCornerRadius:10.0];//设置矩形四个圆角半径

    [self.loginBtn.layersetMasksToBounds:YES];      //很重要

//    [self.loginBtn setBackgroundColor: [UIColor colorWithIntRed:148 green:139 blue:137] ];   //因为需要不同状态,setBackgroundColor 没有提供

    [self.loginBtnsetBackgroundImage:[UIImageimageWithColor:[UIColorcolorWithIntRed:148green:139blue:137alpha:255*0.4]]forState:UIControlStateNormal];

    [self.loginBtnsetBackgroundImage:[UIImageimageWithColor:[UIColorwhiteColor]] forState:UIControlStateHighlighted];

    [self.viewaddSubview:self.loginBtn];

0 0
原创粉丝点击