viewのあるほうこうにだけ枠線をつける方法
コピペで使える!!はず!
private func setupBorder(view:UIView) {
let bottomBorder = CALayer()
bottomBorder.frame = self.getCGrect(view: view,text:"buttom")
bottomBorder.backgroundColor = 色設定
view.layer.addSublayer(bottomBorder)
}
private func getCGrect(view:UIView,text:String)->CGRect {
switch text {
case "bottom":
return CGRect(x: 0, y: view.frame.height, width: view.frame.width, height: 1.0)
case "up":
return CGRect(x: 0, y: 0, width: view.frame.width, height: 1.0)
case "right":
return CGRect(x: view.frame.width, y: 0, width: 1.0, height: view.frame.height)
case "left":
return CGRect(x: 0, y: 0, width: 1.0, height: view.frame.height)
default:
break
}
}