0
votes

I have the following code in my UINavigationBar category:

- (CGSize)sizeThatFits:(CGSize)size
{
    CGSize newSize = [super sizeThatFits:size];
    newSize.height = 44;
    return newSize;
}

for some reason when my view is on landscape the size widt (on the newSize variable) on iPad is 512px instead of 1024. Any idea why?

1

1 Answers

0
votes

Do this:

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration {
  //[super willAnimateRotationToInterfaceOrientation:orientation duration:duration];
  CGRect frame = self.navigationController.navigationBar.frame;
  frame.size.height = 44;
  self.navigationController.navigationBar.frame = frame;
}