更改发件人的cornerRadius

时间:2012-08-08 08:18:59

标签: iphone objective-c ios

我的代码:

-(void)buttonTap:(id)sender {
    UIButton* myButton = (UIButton*)sender;
    [[sender layer] setCornerRadius:15.0f]; //nothing happens
    myButton.layer.cornerRadius = 15.0f; //nothing happens
    myButton.hidden = YES; //works fine
}

如何更改发件人的cornerRadius?

1 个答案:

答案 0 :(得分:3)

您会尝试添加button.clipsToBounds = YES。可能是UIButton控件使用忽略属性cornerRadius的子视图。

相关问题