Comments (5)
override func viewDidLoad() {
...
imageView.layer.superlayer?.insertSublayer(pulsator, below: imageView.layer)
...
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
pulsator.position = imageView.layer.position
}
from pulsator.
I believe this should be centered by default as well, or at the very least customizable by the API.
from pulsator.
I added this line and it set the position correctly:
pulsator.position = sourceView.layer.position
That way I didn't need to override that method out just to correct the position, not sure if there is ramifications to this method for other use cases but it worked as well in my case and isolated my code to a single method.
--
It might be nice to provided a convenience initialization method for the element, since drawing behind and center to another view is a common (most used?) use case. That could make the API more friendly for the norm
from pulsator.
I hope this was resolved. Thanks @marciliojrs for your support!
from pulsator.
I've added the following code and that worked for me:
pulsator.position = CGPoint(x: yourView.bounds.width / 2, y: yourView.bounds.height / 2)
There's also a center property available, so this works too:
pulsator.position = yourView.center
from pulsator.
Related Issues (20)
- Google Map HOT 2
- UI Issues HOT 1
- Can't get the pulse positioned behind a button... HOT 5
- No such module 'QuartzCore.QuartzCore'
- Is there any way to delay the start of the next animation cycle once the first is complete?
- Carthage build fails HOT 5
- square pulse in google map? HOT 1
- Won't compile on Swift 4.2 HOT 8
- NavigationBar bar button customView doesn't work properly.
- Pulsator animaton does not appear HOT 4
- Swift 4.2 is not available 0.5.3 HOT 5
- need to pause animation
- Pulsator has no member isReversed
- Swift 5 Support HOT 1
- Pulse is not centered to view HOT 1
- Swift Package Manager HOT 1
- Adding via SPM does not work in Xcode 11.3.1 HOT 2
- Drop support for iOS 8 HOT 1
- pulsator not show? HOT 2
- SwiftUI support?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pulsator.