2

I'm working with Auto Layout Visual Format Language and using the following expressions:

  • H:|[_tableView]|
  • H:|[_actionButton]|
  • V:|[_tableView][_actionButton(==buttonHeight)]|

They work fine in 9 and 10, but in iOS 8.1 we noticed that the layout is not working as expected. The view is getting the double of dimensions.

  • For iOS 10
  • <UIWindow: frame = (0 0; 320 568);>
  • <UIView: frame = (0 0; 320 568);

  • For iOS 8.1

  • <UIWindow: frame = (0 0; 320 568);>
  • <UIView: frame = (0 0; 640 1136);>

The testing code im using:

Thanks in advance

1 Answers1

0

This bug appears to be caused in your app delegate, by initializing the window and calling makeKeyAndVisible before it has a frame. Replace this line:

self.window = [UIWindow new];

With an explicit frame on initialization:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

...and remove the redundant line setting the window's frame afterwards. Alternatively you could move the call to makeKeyAndVisible after the setting the window's frame, ie:

if (initViewController)
{
    self.window = [UIWindow new];
    self.window.rootViewController = initViewController;
    self.window.frame = [[UIScreen mainScreen] bounds];
    [self.window makeKeyAndVisible];

    return YES;
}

Either way should work.

davidf2281
  • 1,319
  • 12
  • 20