xcode - Delayed response when changing label text (Swift) -


my issue when imagefound == false, prints out "no results!!!" immediately, takes 15 seconds labels text change. not know why lagging need trying i=to put down range of 5 seconds or less. help? code below...

if let textfieldcontent = textfield.text{         {              try wikifacerec.faceforperson(textfieldcontent, size: cgsize(width: 200, height: 250), completion: {(image:uiimage?, imagefound:bool!) -> ()  in                 if imagefound == false{                     self.faceimageview.alpha = 0                     self.realloadinglbl.text = "no results found. check spelling , try again."                     print("no results!!!!!")                  }                 if imagefound == true{                    self.realloadinglbl.alpha = 0                     dispatch_async(dispatch_get_main_queue(), {() -> void in                         self.faceimageview.image = image                          self.faceimageview.alpha = 1                         wikifacerec.centerimageviewonface(self.faceimageview)                     })                  }             })         } catch wikifacerec.wikifaceerror.couldnotdownloadimage {             print("wikipedia not open")          } catch {             print("error")             self.faceimageview.alpha = 0             self.realloadinglbl.text = "no results found. check spelling , try again."             print("no results")         }     }     return true } 

the code below self.realloadinglbl.text = "no results found. check spelling , try again." part takes bit change. , yes, once again "no results!!!" printed immediately.

if imagefound == false{     self.faceimageview.alpha = 0     self.realloadinglbl.text = "no results found. check spelling , try again."     print("no results!!!!!") } 

any , appreciated. thanks!

you have handle imagefound==false case similar true case in terms of dispatch_async:

if !imagefound {     dispatch_async(dispatch_get_main_queue()) {         self.faceimageview.alpha = 0         self.realloadinglbl.text = "no results found. check spelling , try again."         print("no results!!!!!")         self.faceimageview.alpha = 0                           } } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -