ios - Presenting a Modal ViewController from a TableViewController lags -


i have uitableviewcontroller needs present view controller modally when cell tapped. i'm using didselectrowat this.

the modal view controller custom uiviewcontroller subclass has loadfromstoryboard() class method load it.

sometimes when tap cell, view controller presented without issue. however, other times doesn't show until i, instance, try scroll on tableview or tap cell.

i'm guessing sort of problem threading. however, throughout entire app, never delegate task thread or start queue @ all.

n.b.: using swift 3.

update

here's loadfromstoryboard() method:

class func loadfromstoryboard(particle: particleprotocol, isfavourite: bool = false) -> particledisplayviewcontroller {     let storyboard = uistoryboard(name: "main", bundle: nil)     if let viewcontroller = storyboard.instantiateviewcontroller(withidentifier: "particledisplayviewcontroller") as? particledisplayviewcontroller {          viewcontroller.particle = particle         viewcontroller.isfavourite = isfavourite          return viewcontroller     } else {         fatalerror("can't find particledisplayviewcontroller in main storyboard")     } } 

and here didselectrowat uitableviewcontroller:

override func tableview(_ tableview: uitableview, didselectrowat indexpath: indexpath) {     switch indexpath.section {     case 1:         let isfavourite = particlestoragemanager.standardmodelparticleisfavourite(index: indexpath.row)         self.present(particledisplayviewcontroller.loadfromstoryboard(particle: standardmodelparticles[indexpath.row], isfavourite: isfavourite), animated: true, completion: nil)     case 0:         let isfavourite = particlestoragemanager.savedparticleisfavourite(index: indexpath.row)         self.present(particledisplayviewcontroller.loadfromstoryboard(particle: self.particles[indexpath.row], isfavourite: isfavourite), animated: true, completion: nil)     default:         self.contextkey = "addingparticle"         self.present(createparticletableviewcontroller.loadfromstoryboard(reciever: self), animated: true, completion: nil)     }  } 

pariclestoragemanager reads , writes data userdefaults.

here's viewdidload() modal view controller:

override func viewdidload() {     self.view.backgroundcolor = .clear()      self.particleviewcontainer.layoutifneeded()     self.particleviewcontainer.addsubview(particleview(position: cgpoint.zero, width: particleviewcontainer.width, particle: self.particle, isfavourite: self.isfavourite))      propertiestableview.backgroundcolor = uicolor.white().withalphacomponent(0.3)     propertiestableview.layer.borderwidth = 1.5     propertiestableview.layer.bordercolor = uicolor.black().cgcolor     self.propertiestableview.blur() } 


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -