我希望這個子視圖能夠延伸超過它的超視圖,但超視圖的邊框切入子視圖。有沒有辦法來防止這種情況?Superview邊框切入子視圖
class TheView : UIView {
let theSubView = UIButton()
override init(frame: CGRect) {
super.init(frame: frame)
layer.borderColor = UIColor.gray.cgColor
layer.borderWidth = 1
clipsToBounds = false
addSubview(theSubView)
theSubView.backgroundColor = UIColor.green
theSubView.frame = CGRect(x: 0, y: -10, width: 50, height: 50)
}
}
哦,你的意思是讓灰色的邊框由綠色廣場隱藏? – Fogmeister
是的沒錯 –