我是一名有用的助手,可以为您提供翻译。以下是您需要翻译的内容:
我在我的屏幕顶部有一个 UIView
,我想给它添加一个右边框,宽度为1像素。
这是我目前拥有的代码:
var border = CALayer()
border.backgroundColor = UIColor(red: 241, green: 10, blue: 9, alpha: 1).cgColor
border.frame = CGRect(x: topView.frame.width + 1, y: 0, width: 1, height: topView.frame.height)
topView.layer.addSublayer(border)
但是我无法使其正常工作。
我该怎么做才能为我的UIView
添加右边框?
先行致谢!