pmb pmb - 1 year ago 64
iOS Question

How to add view in center of view

I have view which has 200x200 width and height

let pulsator = Pulsator()
pulsator.radius = 240.0
pulsator.numPulse = 5
viewSearchArea.layer.addSublayer(pulsator)
pulsator.start()


I want pulsator will be set center of viewSearchArea.
How could i do this?
If anyone wants to know what is pulsator here is the link

Answer Source

Try this.

pulsator.position = CGPoint(viewSearchArea.layer.bounds.midX, viewSearchArea.layer.bounds.midY)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download