Monday, 26 August 2013

Hide or temporarily remove a child ViewController from a parentViewController?

Hide or temporarily remove a child ViewController from a
parentViewController?

(asking and self-answering, since I found no hits on Google, but managed
to find a solution in the end by trial and error)
With iOS 5 and 6, Apple added some ugly hacks to make InterfaceBuilder
support "embedded" viewcontrollers. They didn't document how those work,
they only give code-level examples, and they only cover a limited subset
of cases.
In particular, I want to have an embedded viewcontroller that is sometimes
hidden - but if you try the obvious approach it doesn't work (you get a
white rectangle left behind):
childViewController.view.hidden = TRUE;

No comments:

Post a Comment