[英]How can you round only 2 of the corners on a Xamarin.iOS UITableView?
[英]How to round only corners on a UITableView?
我試圖只圍繞我的桌面視圖的右上角和左上角。 我正在使用下面的代碼,它似乎只是繞過左上角......
CAShapeLayer *topLayer = [CAShapeLayer layer];
UIBezierPath *roundedPath =
[UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerTopLeft cornerRadii:CGSizeMake(9.f, 9.0f)];
topLayer.path = [roundedPath CGPath];
希望這會奏效。 找到創建遮罩層的頂角路徑
UIBezierPath *PathToMask;
PathToMask = [UIBezierPath bezierPathWithRoundedRect:self.testView.bounds
byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)
cornerRadii:CGSizeMake(8.0, 8.0)];
使用UIBezierPath maskPath創建形狀圖層蒙版
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame =self.testView.bounds;
maskLayer.path = PathToMask.CGPath;
設置遮罩層maskLayer
self.testView.layer.mask = maskLayer;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.