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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -