Not working when Background view Dynamically
Kida007 opened this issue · comments
PIYUSH GUPTA commented
Hey @Minecodecraft thanks for the lib . Im new to swift , and try to run this lib through react-native.
Problem : the scratch action doesn't work as soon as i add backgroundView ( mainImageView) .
Here is my Example :
class ScratchCardView: UIView {
override init(frame: CGRect){
super.init(frame:frame)
let mainImageView = UIImageView(image:UIImage(named:"pin.jpg"))
mainImageView.frame = CGRect(x:0,y:0,width:300,height:300)
var scratchImageView: MCScratchImageView!
scratchImageView = MCScratchImageView(frame:CGRect(x:0,y:0,width:300,height:300))
scratchImageView.setMaskImage(UIImage(named:"pin.jpg")!, spotRadius: 10)
self.addSubview(mainImageView)
self.addSubview(scratchImageView)
}
}
as soon as I comment self.addSubview(mainImageView)
it works !
PIYUSH GUPTA commented
sorry my bad , i used the same image xD , lol !!!!!!!!!