UIView及其子類 切圓角

2021-07-13 14:19:02 字數 1003 閱讀 4735

1、切四個圓角以uiimageview為例

//設定圓角

self

.testimageview

.layer

.cornerradius = 10.0;

//裁剪多餘的,即把圓角的切掉

2、切指定某幾個的圓角

//第乙個引數:你要切圓角的frame 第二個引數:指定你要切的圓角 第三個引數:圓角的大小,好像只和寬度有關

uibezierpath *path = [uibezierpath bezierpathwithroundedrect:self.testimageview

.frame byroundingcorners:uirectcornertopright | uirectcornerbottomleft cornerradii:cgsizemake(30, 0)];

cashapelayer *shapelayer = [[cashapelayer alloc] init];

shapelayer.frame = self.testimageview

.bounds

;shapelayer.path = path.cgpath

;self.testimageview

.layer

.mask = shapelayer;

選擇你要切得某幾個圓角

UIView及其子類

如何建立乙個uiview 1.初始化乙個uiview物件 uiview view uiview alloc 初始化方法 2.設定uiview屬性 例如 顏色 3.把uiview 檢視 載入到視窗上 4.釋放物件 建立乙個uilabel 只要是顯示的控制項 都是這4步 1.初始化 2.設定屬性 3.新...

UIView及其子類

建立window self window uiwindow alloc init 讓window和螢幕的寬高一樣,位置也一樣 window.frame uiscreen mainscreen bounds bounds 0,0,螢幕寬,螢幕高 window.backgroundcolor uicol...

UIView畫圓 切圓環

對於一些圓,或者圓環我們可以用uiview進行切出來。案例 原圖 效果圖 主要 如下 設定圓環 self.pointview.layer.cornerradius 11 設定圓形的程度 self.pointview.layer.maskstobounds yes 設定是否切圓 self.pointv...