ios - Updating UI as the result of a request handler -
i have setup this;
startup() { ... self.gcdwebserver.addhandlerformethod("get", path: "/hide", requestclass: gcdwebserverrequest.self, asyncprocessblock: {request in self.hide()}) ... } func hide() -> gcdwebserverdataresponse { self.view.hidden = true; print("hide") return gcdwebserverdataresponse(statuscode: 200) }
when request /hide
made, console shows print()
call immediately, view not disappear arbitrary delay, somewhere between 10-30 seconds.
how can have request result in view being hidden?
try one, calling hidden on main thread.
dispatch_async(dispatch_get_main_queue(),{ self.view.hidden = true; })
Comments
Post a Comment