Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS autolayout performance issue in portrait mode. [NSISEngine optimize]
    text
    copied!<p>I have encountered a very strange problem and I was wondering, if anyone could help me out here since I'm totally lost. </p> <p>Context: I am developing an app with a relatively simple hierarchy. Just a few view controller but quite a lot of high-res images. They are presented in a <code>UIScrollView</code> with some text etc. While testing it in portrait mode the scrollview didn't scroll smoothly at all. It seemed like the framerate droped to about 4-5 fps. First I thought it was because of the high-res images.</p> <p>But then I turned the iPad to landscape mode and everything ran smoothly. Since the I have a separate xib-file for portrait and landscape, I thought there has to be a problem in the portrait-xib. It turned out, there wasn't. Both had the same VC-class and where therefore using the same code and both xibs are almost identical except for the sizes and positions of the views. </p> <p>To narrow the problem down, I used Instrument's TimeProfiler to see whats causing the problem. As it turned out, TimeProfiler showed some calls to <code>[NSISEngine optimize]</code> (triggered by <code>NSLayoutConstraint</code>). In portrait mode were more calls and those calls took much longer. Further down the tree I saw that in portrait mode <code>[NSISEngine optimize]</code> called <code>[NSISEngine fixupIntegralizationViolations]</code> and in landscape it didn't.</p> <p>I even removed all the viewcontroller's from the app except for the rootVC and one other which is presented by the rootVC. The presented vc just contains some images, buttons and some animations. It has only one xib for both orientations and is (as all others too) layed out with autolayout. </p> <p>The layout works as it should in both orientations and there are no ambiguities (as far as i can tell. at least <code>po [[UIWindow keyWindow] _autolayoutTrace]</code> doesn't show any).</p> <p>I've attached a screenshot of the TimeProfile of the presentation process of the vc. One for portrait and one for landscape. As you can see, in landscape the calls to <code>[NSISEngine optimize]</code> take only a millisecond while in portrait they take over 3000ms.</p> <p>Is there anyone who can tell me why that is? Or maybe has any idea what I can do to find out what the problem is? </p> <p>Any help would be greatly appreciated!</p> <p>Thx</p> <p>Link to a larger version of the image: <a href="http://www.pic-upload.de/view-16503686/iOS_AutoLayout_Performance_Issue.jpg.html" rel="noreferrer">link</a></p> <p><img src="https://i.stack.imgur.com/kVSen.jpg" alt="Instruments Timeprofiler screenshot"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload