-1

我的代码:

-(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?

4

1 回答 1

3

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

于 2012-08-08T08:25:49.670 回答