ios - 颜色问题外的惊人圆角半径
<p><p>这是我添加到新 ViewController 的代码:</p>
<pre><code>- (void)viewDidLoad
{
;
UIView *contentView = [ initWithFrame:CGRectMake(50, 50, 200, 100)];
;
];
;
[ setBorderColor:[ CGColor]];
[ setBorderWidth:1.0f];
[ setCornerRadius:5.0f];
[ setMasksToBounds:YES];
}
</code></pre>
<p>结果:</p>
<p> <img src="/image/pWsSx.png" alt="enter image description here"/> </p>
<p>如果看角落,我们可以看到外面的蓝色像素:</p>
<p> <img src="/image/yJBmq.png" alt="enter image description here"/> </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以使用 CAShapeLayer :</p>
<pre><code>- (void)viewDidLoad
{
;
UIView *contentView = [ initWithFrame:CGRectMake(50, 50, 200, 100)];
;
CAShapeLayer *subLayer = [ init];
.CGColor];
.CGColor];
;
.CGPath];
;
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 颜色问题外的惊人圆角半径,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/29213208/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/29213208/
</a>
</p>
页:
[1]