ios - How to set button image to nil in Swift? -
in reset button want reset game when try set image nil xcode displays error:
could not cast value of type 'uiview' (0x106c26e88) 'uibutton' (0x106c2cf68).
this code:
var button : uibutton var = 0; < 9; i++ { button = self.view.viewwithtag(i) as! uibutton button.setimage(nil, forstate: .normal) }
you can insert nil image button
let btncheckmarkimage = uiimage(cgimage: nil) checkboxbtn.setimage(btncheckmarkimage, forstate: uicontrolstate.normal)
Comments
Post a Comment