ios - "Ghost" view appearing -
to cleaner app, each cell in table view has view original 1 made match background. each cell associated video in documents folder. have setup video can renamed. however, video renamed, "ghost" view appears. have absolutely no idea on why or how possible. here's name changed:
do { var urlmov = cell.videourl! let jpgdelete = cell.urljpg var valuesmov = urlresourcevalues.init() if ((alertalcon.textfields!.first?.text?.characters.count)! >= 15){= let tmalcon = uialertcontroller(title: "too long", message: "the name entered long", preferredstyle: .alert) let tmcancelal = uialertaction(title: "cancel", style: .cancel, handler: {action in self.present(alertalcon, animated: true, completion: nil) }) tmalcon.addaction(tmcancelal) self.present(tmalcon, animated: true, completion: nil) } if ((alertalcon.textfields!.first?.text?.characters.count)! <= 14){ valuesmov.name = (alertalcon.textfields!.first?.text)! + ".mp4" try urlmov.setresourcevalues(valuesmov) try! filemanager().removeitem(at: jpgdelete!) } } catch { swift.print("error in rewrite ", error) }
and view made:
let rectangle = cgrect(x: 0, y: 0, width: parent.view.frame.width, height: 88) let myview : uiview = uiview(frame: rectangle) myview.center = self.center myview.backgroundcolor = uicolor.white self.contentview.addsubview(myview) self.contentview.sendsubview(toback: myview)
here's screenshots of what's going on:
does have idea on why happening????
with bilal's help, found view function continually adding more views cell due way have reload data in table view. able fix looking in cell's subviews view's tag, , deleting view if there. here's function:
func setviews(){ let selectedview = uiview() selectedview.backgroundcolor = uicolor.init(red: 0.0/255.0, green: 75.0/255.0, blue: 150.0/255.0, alpha: 0.25) self.selectedbackgroundview = selectedview if let viewwithtag = self.contentview.viewwithtag(821){ viewwithtag.removefromsuperview() } let rectangle = cgrect(x: 0, y: 0, width: parent.view.frame.width, height: 88) let myview : uiview = uiview(frame: rectangle) myview.center = self.contentview.center myview.backgroundcolor = uicolor.white myview.tag = 821 self.contentview.addsubview(myview) self.contentview.sendsubview(toback: myview) }
Comments
Post a Comment