ios - Swift Call ViewController after url loading finishes -


i'm building app following: user logins username , password, after login retrieve data website through html parsing. these data want pass them other viewcontroller table view controller show data in cells there.

i connected login button other viewcontroller seague, can't keep waiting till data available.

how can this?

override func prepareforsegue(segue: uistoryboardsegue,     sender: anyobject?) {      if segue.identifier == "supplierdetails" {     let detailviewcontroller = segue.destinationviewcontroller     supplierdetails      detailviewcontroller.data = data       } }  func postrequest() {      self.spinner.hidden = false     self.spinner.startanimating()      let request = nsmutableurlrequest(url: nsurl(string: "http://example.com/login.aspx")!)     request.httpmethod = "post"     let poststring = "something"     request.httpbody = poststring.datausingencoding(nsutf8stringencoding)     let task = nsurlsession.sharedsession().datataskwithrequest(request) {         data, response, error in          if error != nil {             println("error=\(error)")             dispatch_async(dispatch_get_main_queue(), {                 self.spinner.stopanimating()                 self.spinner.hidden = true             });              return         }          dispatch_async(dispatch_get_main_queue(), {             self.spinner.stopanimating()             self.spinner.hidden = true             self.data = parsehtml.getcontent(data)             self.transition()             });     }     task.resume() } 

disconnect segue button. when you're ready move other view controller, call segue using performseguewithidentifier(_:sender:).


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -