pgorzelany/ScratchCardView
Tentang
A scratch card view for iOS
Pengembangan web dan aplikasiPertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- 0
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliScratchCardView
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.
Jelajahi proyek terkait
Memuat…