0

I'm having problems with the layout on the iphone 4 and iphone 5. Actually the iphone 4, everything works, the problem is the iphone 5. The issue in iPhone5 is where have the green circle. The login page, it lost some parts of box inside navigation bar and the back button not show, in the list page not show background image and the title is black!

Follows pictures:

iPhone 4 - iOS 5.1.1

iPhone 4 - login is ok red view up table is OK

iPhone 5 - iOS 7.0.3

login background is up to navigation bar red view up table is not show

Here is how i set the background image to view up the table:

UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
self.viewUp.backgroundColor = background;

And here how i set the back button with Appearance proxy in my appDelegate

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];

UIImage *backButtonHomeImage = [[UIImage imageNamed:@"navegacao_botao_voltar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonHomeImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
rmaddy
  • 314,917
  • 42
  • 532
  • 579
bertu
  • 55
  • 2
  • 8
  • it works for the first image, login page!! the list page where i have a red view, it not work!! The red view in iphone 5 isn't showed – bertu Oct 31 '13 at 17:14

1 Answers1

2

The problem is related with the iOS version, no with the phone size.

In iOS7, your views are by default extended to fill the whole screen, so on your view controller you have to do:

self.edgesForExtendedLayout = UIRectEdgeNone;

To cancel that effect.

You can find the explanation and more info here:

Explaining difference between automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars, edgesForExtendedLayout in iOS7

Community
  • 1
  • 1
Antonio MG
  • 20,382
  • 3
  • 43
  • 62
  • Yes, it works for the login page, but in the list page where the red view not show it not work!!! And how i set the back button ? – bertu Oct 31 '13 at 17:12
  • You have to add it to every view controller – Antonio MG Oct 31 '13 at 18:20
  • I have error... when i use iPhone 5 this code works fine! But when i deploy to iPhone 4 i got this error: BaseViewController.m:94:18: Property 'edgesForExtendedLayout' not found on object of type 'BaseViewController *' – bertu Oct 31 '13 at 19:19
  • In all ViewController that i add this code, i got this error: EstabelecimentoListViewController.m:48:18: Property 'edgesForExtendedLayout' not found on object of type 'EstabelecimentoListViewController *' – bertu Oct 31 '13 at 19:19