2013-08-28 63 views
2

我已經應用邊框和圓角半徑,以一個UIButton這樣:刪除圓角半徑的UIButton

self.Button3.layer.borderWidth = 10; 
self.Button3.clipsToBounds = NO; 
[self.Button3.layer setCornerRadius:100.0f]; 

我想知道是否有一種方法來消除他們兩個,不這樣做:

self.Button3.layer.borderWidth = 0; 
self.Button3.clipsToBounds = NO; 
[self.Button3.layer setCornerRadius:0.0f]; 

我認爲這隻會隱藏,不能刪除它們。

回答

1

我認爲這是要走的路,因爲CALayer沒有提供API來「移除」除borderWidth屬性之外的其他邊框。根據文件,CALayer只是「畫」的邊界,所以,我不認爲CALayer持有像UIViewUIImage繪製邊界。

當該值大於0.0時,層繪製使用 當前BORDERCOLOR值的邊界。邊界從 接收器邊界被插入此屬性中指定的值。它是在接收者的內容和子層之上合成的 ,並且包括 cornerRadius屬性的效果。