Closed designfrontier closed 3 years ago
with the position line commented out it appears slightly above and to the right of the button
Facing similar issue
Hi, try changing this line: button.layer.insertSublayer(pulsator, below: button.layer) with: "buttons PARENT VIEW".layer.insertSublayer(pulsator, below: button.layer) This works for me hope it helps :).
@designfrontier Hey this must be happening because you are setting it before subview layout properly. You need to paste this code in viewDidLayoutSubviews function , it should work fine
Try putting it in viewDidAppear
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
guard button.layer.sublayers?.contains(pulsator) != true else { return } // prevent adding the layer multiple times
button.layer.insertSublayer(pulsator, at: .zero)
}
Also setting
pulsator.position
makes it disappear completely?