我试图只旋转一个UITextField的左上角和左下角。下面是我使用的代码:
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
let maskLayer = CAShapeLayer()
maskLayer.path = UIBezierPath(roundedRect: locationText.bounds, byRoundingCorners: .TopLeft | .BottomLeft, cornerRadii: CGSize(width: 10.0, height: 10.0)).CGPath
locationText.layer.mask = maskLayer;
}线
maskLayer.path = UIBezierPath(roundedRect: locationText.bounds, byRoundingCorners: .TopLeft | .BottomLeft, cornerRadii: CGSize(width: 10.0, height: 10.0)).CGPath正在产生错误
Cannot assign a value of type 'CGPath' to a value of type 'CGPath?'这让我很困惑,因为我已经能够在代码的其他地方为选项设置值,没有问题。有人能帮我明白我做错了什么吗?
发布于 2015-08-26 15:31:40
如果在Xcode beta中使用的是快速2.0,那么可能是编译器的错误,它试图告诉您应该使用数组来指示角
maskLayer.path = UIBezierPath(roundedRect: self.view.bounds, byRoundingCorners: [.TopLeft, .BottomLeft], cornerRadii: CGSize(width: 10.0, height: 10.0)).CGPathhttps://stackoverflow.com/questions/32230603
复制相似问题