ios - 如何在 swift 4.2 中将 UIView 变成圆形?
问题描述
UIView 的 width(40) 和 height(40) 相等。
我已经尝试过这些,但它们对我不起作用:
countView?.clipsToBounds = true
self.countView?.layer.cornerRadius = min((countView?.frame.size.width)!, (countView?.frame.size.height)!)/2
并且
self.countView.layer.cornerRadius = (countView.frame.size.width)/2
谢谢
解决方案
推荐阅读
- user-interface - 尽管没有错误或警告,为什么没有显示窗口
- javascript - 有没有人体验过 IE 在与 VPS 一起使用时缺乏网站性能?
- react-native - 如何在本机反应中为整个应用程序(如每个屏幕)在屏幕底部显示自定义视图
- laravel - 没有为 [erros] laravel 5.6 定义提示路径
- css - 如何在选定选项卡上的 React JS 中动态添加类名
- python - 使用四元数对3D空间中的对象进行坐标校正
- python - 用 numpy 掩码数组绘图
- zapier - 如何查看使用我们的 zapier 应用程序的用户列表?
- shell - 如何在 Xamarin.Forms 4.0 Shell.TitleView 中居中 ImageView?
- java - 如何修复包含泛型的方法