![](/img/trans.png)
[英]Using maskToBounds set to true with cornerRadius doesn't change the view
[英]Using UIColor tiled images as the background of a view doesn't work with cornerRadius
我已經使用UIColor colorWithPatternImage獲得平鋪的顏色。 我將此設置為我的觀點的背景。 此后,對view.layer.cornerRadius所做的任何更改都不會產生任何影響:它不會更改拐角半徑。 我還嘗試向視圖添加另一個子視圖,將背景顏色設置為圖案,並在視圖上使用cornerRadius無濟於事。
我該如何解決此問題?
謝謝你的時間。
將視圖的clipsToBounds設置為YES,它將起作用。 我遇到過同樣的問題。
這是我的片段:
self.leftPanelView.layer.cornerRadius = 10;
self.leftPanelView.clipsToBounds = YES;
self.leftPanelView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"linePattern_gray.png"]];
它將linePattern_gray.png顯示為帶有圓角的背景圖案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.