help wantedpossible bug
Repository metrics
- Stars
- (619 stars)
- PR merge metrics
- (PR metrics pending)
Description
I'm having problem with margins when I instantiate a view controller inside an async task.
When I do this, the view loads weird:
let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
dispatch_async(dispatch_get_global_queue(priority, 0)) {
//Web Service call
dispatch_async(dispatch_get_main_queue()) {
let viewController = UIStoryboard(name: "Tracking", bundle: nil).instantiateViewControllerWithIdentifier("tracking") as! CarrierTrackingVC
viewController.truckTrack = TruckTrack()
elDrawer.mainViewController = viewController
}
}

But when I do it outside the async task it looks ok:

I'm loading it in the main thread, inside dispatch_async(dispatch_get_main_queue())
so I don't understand why it behaves like that.
viewController is a UITabBarController, each tab contains a NavigationController, and each NavigationController contains a ViewController
UITabBarController > NavigationController > ViewController