Search code examples
iosobjective-cios8popoveruimodalpresentationstyle

Width of UINavigationController view in iOS8 modal popover?


In my iPad app, I present a navigation controller in a modal form sheet, and set the width of a label therein to be the width of that navigation controller (i.e. the full width of the form sheet).

In iOS7, this works perfectly. In iOS8, that width is reported as the full width of the device (either 768 or 1024 points). I realise that these popovers have been somewhat deprecated on iOS8, but is there a means of getting the correct width of the form sheet in this situation in iOS8?


Solution

  • View's frame is not correctly when just created. You can get actual frame in view controller's - viewDidLayoutSubview or view's - layoutSubview.

    Set your label width in - viewDidLayoutSubview of your view controller.