私はviewdidload()で以下のコードを適用しましたが、このコードボーダーを使用していますが、table content.iでスクロールすると、側。ios:tableviewの上部と下部に境界を追加したい
ここに私のコードがある - >
let topBorder = CAShapeLayer()
let topPath = UIBezierPath()
topPath.move(to: CGPoint(x: 0, y: 0))
topPath.addLine(to: CGPoint(x: tblFilter.frame.width, y: 0))
topBorder.path = topPath.cgPath
topBorder.strokeColor = UIColor.red.cgColor
topBorder.lineWidth = 1.0
topBorder.fillColor = UIColor.red.cgColor
tblFilter.layer.addSublayer(topBorder)
let bottomBorder = CAShapeLayer()
let bottomPath = UIBezierPath()
bottomPath.move(to: CGPoint(x: 0, y: tblFilter.frame.height))
bottomPath.addLine(to: CGPoint(x: tblFilter.frame.width, y: tblFilter.frame.height))
bottomBorder.path = bottomPath.cgPath
bottomBorder.strokeColor = UIColor.red.cgColor
bottomBorder.lineWidth = 1.0
bottomBorder.fillColor = UIColor.red.cgColor
tblFilter.layer.addSublayer(bottomBorder)
私suggetionと感謝
適切な値でこのメソッドを養う
上記の方法のためにこれらの列挙型を使用してご覧ください。 。あなたの 'CGPoints'の数学も間違っています。層が範囲外に追加されるからです。 – Oskar