iOS之给button加边框 . 圆角弧度 . 加阴影

 //头像

        avatarImage = [UIButton buttonWithType:UIButtonTypeCustom];

        //给按钮加一个白色的板框

        avatarImage.layer.borderColor = [[UIColor whiteColor] CGColor];

        avatarImage.layer.borderWidth = 1.0f;

        //给按钮设置弧度,这里将按钮变成了圆形

        avatarImage.layer.cornerRadius = 25.0f;

        avatarImage.backgroundColor = [UIColor redColor];

        avatarImage.layer.masksToBounds = YES;

你可能感兴趣的:(IOS)