我有一個UIView和兩個子視圖。子視圖具有圓角和邊框值。我遇到的問題是圓角邊框的外邊緣包含子視圖背景顏色的細線。我肯定錯過了什麼??具有圓角和邊框的UIView有錯誤的邊緣顏色
UIView *outerView = [[UIView alloc] initWithFrame:CGRectMake(0, 50, 320, 320)];
[self.view addSubview:outerView];
outerView.backgroundColor = [UIColor whiteColor];
UIView *innerView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 160, 320)];
[outerView addSubview:innerView1];
innerView1.backgroundColor = [UIColor blackColor];
innerView1.layer.borderWidth = 20;
innerView1.layer.borderColor = [UIColor whiteColor].CGColor;
innerView1.layer.cornerRadius = 20;
//innerView1.layer.masksToBounds = YES;
UIView *innerView2 = [[UIView alloc] initWithFrame:CGRectMake(160, 0, 160, 320)];
[outerView addSubview:innerView2];
innerView2.backgroundColor = [UIColor blackColor];
innerView2.layer.borderWidth = 20;
innerView2.layer.borderColor = [UIColor whiteColor].CGColor;
innerView2.layer.cornerRadius = 20;
//innerView2.layer.masksToBounds = NO;
//innerView2.clipsToBounds = YES;
//innerView2.layer.shouldRasterize = YES;
這將有助於包括顯示這一問題的相關截圖貝塞爾曲線路徑。 – rmaddy
我用綠色背景運行了你的代碼,這就是我所得到的 - > http://puu.sh/89bjO/6e551e085e.png就是你所得到的?我沒有真正將你的問題與我得到的相匹配 –
我現在看到你的錯誤。我搞亂了代碼,看看造成這種情況的原因。 –