如何创建一个圆角的NSImageView? [英] How to create a NSImageView with a rounded corner?

查看:474
本文介绍了如何创建一个圆角的NSImageView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我想要创建一个圆角NSImageView,我是一个newb,如何?

Currently now i want to create a round corner NSImageView,i am a newb,how to ?

推荐答案

t知道这将工作,所以请尝试它,我们将交叉我们的手指。在iPhone上,您可以使用任何 UIView CALayer NSView 在iOS中的对手),以获得圆角。基于参考文档, NSView 支持此操作,但是您必须再次尝试。

I don't know if this will work so please try it and we'll cross our fingers. On the iPhone you can use the CALayer of any UIView (the NSView counterpart in iOS) to get rounded corners. Based on the reference docs it appears that NSView supports this but again you'll have to try it. Please let me know if it works.

NSImageView *view = your view;

[view setWantsLayer: YES];  // edit: enable the layer for the view.  Thanks omz

view.layer.borderWidth = 1.0;
view.layer.cornerRadius = 8.0;
view.layer.masksToBounds = YES;

您还可以修改borderWidth和 borderColor 属性。

You can also modify the borderWidth and borderColor properties.

这篇关于如何创建一个圆角的NSImageView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆