setRadiusCorner 位于视图底部
我有一个带有圆角的视图。 我想让它在视图的两个底角处变圆。 我怎样才能做到这一点?
这是我为视图制作圆角的代码:
CALayer *myLayer = moreInfoView.layer;
[myLayer setCornerRadius:20.0];
[view.layer setMasksToBounds:YES];
可能吗?
谢谢!
i have a view with rounded corners.
I want to make it rounded just at the two bottom corners of the view.
How can i do that?
This is my code that makes the rounded corners for the view:
CALayer *myLayer = moreInfoView.layer;
[myLayer setCornerRadius:20.0];
[view.layer setMasksToBounds:YES];
Is it possible?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
仅圆化
UIRectCornerBottomLeft
和UIRectCornerBottomRight
角:Round only the
UIRectCornerBottomLeft
andUIRectCornerBottomRight
corners:不要认为您可以轻松地使用 CALayer 做到这一点 - 您可以继承 NSView 并创建一个简单的重绘例程。可能最容易使用 http://www.cocoadev.com/index.pl?RoundedRectangles 作为起点(在删除您不想舍入的两个贝塞尔路径之后),然后执行一个简单的操作:
在上面的链接中 - 第二个简化的示例使您的生活更轻松 - 因为您可以简单地使其中两个“路径”线到点:..'。
Don't think you can do that with the CALayer with ease - you could subclass NSView and make a simple redraw routine. May be easiest to use http://www.cocoadev.com/index.pl?RoundedRectangles as a starting point (after removing the two bezier Paths you do not want to have rounded) and then do a simple:
In above link - the second simplified example makes your live easier - as you can simply make two of them 'path lineToPoint: ..'.