ios - <Error>: CGAffineTransformInvert: singular matrix. in cellForRowAtIndexPath -
i have tableviewcell button load photo imagepickercontroller.
here code imagepickercontroller. send tableviewcell index tag button find out on cell button clicked. when user selects image gallery sets image background of loading button , saves image array of selected images.
// photo function func getphotofromgallery(sender: uibutton){ celltag = sender.tag picker.allowsediting = false picker.sourcetype = .photolibrary presentviewcontroller(picker, animated: true, completion: nil) } func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) { var chosenimage = info[uiimagepickercontrolleroriginalimage] as! uiimage let cell = tableview.cellforrowatindexpath(nsindexpath(forrow: celltag!, insection: 0)) as! questiontableviewcell cell.photoimageview.setbackgroundimage(chosenimage, forstate: uicontrolstate.normal) photos[celltag!] = chosenimage dismissviewcontrolleranimated(true, completion: nil) }
then in cellforrowatindexpath check image in array default or selected user , set background of button.
// imageview style , target cell.photoloadingbutton.layer.cornerradius = 4.0 cell.photoloadingbutton.clipstobounds = true cell.photoloadingbutton.tag = indexpath.row cell.photoloadingbutton.addtarget(self, action: "getphotofromgallery:", forcontrolevents: uicontrolevents.touchupinside) // set photo imageview if exists else - default if photos[indexpath.row] == uiimage(named: "camera")! { cell.photoloadingbutton.setbackgroundimage(uiimage(named: "camera")!, forstate: uicontrolstate.normal) } else { cell.photoloadingbutton.setbackgroundimage(photos[indexpath.row], forstate: uicontrolstate.normal) }
and works fine think method bad =(
then, when select few images in tableview , scroll table i'm getting message in log: ": cgaffinetransforminvert: singular matrix.". appears when new cell uploaded image shown.
Comments
Post a Comment