pgorzelany/ScratchCardView
À propos
A scratch card view for iOS
Développement web et applicatifProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalScratchCardView
Example
To run the example project, clone the repo, and run pod install from the Example directory first.
Installation
ScratchCardView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ScratchCardView"
Documentation
Extensive documentation can be found Here.
Special thanks to the Jazzy project for automatic documentation generation.
Usage
See the example project for usage.
![]()
You can setup custom views for both the scratch card cover and the cratch card content. The setup is done through a delegate.
class YourViewController: UIViewController {
...
override func viewDidLoad() {
super.viewDidLoad()
configureScratchCardView()
}
private func configureScratchCardView() {
scratchCardView.delegate = self
scratchCardView.scratchWidth = 150
}
}
extension YourViewController: ScratchCardViewDelegate {
func coverView(for scratchCardView: ScratchCardView) -> UIView {
let coverView = UIView()
coverView.backgroundColor = UIColor.gray
return coverView
}
func contentView(for scratchCardView: ScratchCardView) -> UIView {
let imageView = UIImageView(image: yourCustomImage)
imageView.contentMode = .scaleAspectFill
return imageView
}
}
That is all you need to know, its that simple :)
If you want to reload the ScratchCardView call:
scratchCardView.reloadView()
This will trigger a call to your delegate for a new cover and content view.
Author
pgorzelany, [email protected]
License
ScratchCardView is available under the MIT license. See the LICENSE file for more info.
Explorer des projets similaires
Chargement…