Xcode shows the same height for 3.5 inch and 4 inch screen in ios

I am testing my application at 3.5 inches and 4 inches. While I'm NSLog(@"%@", self.view.frame.size.height); both 3.5 inches and 4 inches show a height of 568 . Now I'm currently using xcode 5. Anyone can explain why this looks like this.

+6
source share
3 answers

I think you are using self.view.frame.size.height. In this state, an application using your original view means that your xib height and may be your xib is 4 inches.

If you want to check the height of the UIDevice, than use this condition

 if ([UIScreen mainScreen].bounds.size.height<568) { NSLog(@"3.5 inch screen"); } else { NSLog(@"4.0 inch screen"); } 
+13
source

You should have two startup images - one Default.png (for the 3.5-inch) and another Default-568h.png (for the 4-inch) in your application. Please, check him.

+3
source

It comes back because your xib size is 4-inch full-screen Retina mode. That's why. Therefore, if you really want to, change it in the xib file to either Free Form or None .

Please try to see how it is ... Definitely, it will print according to your screen.

 NSLog(@"%f",[[UIScreen mainScreen ] bounds].size.height); 
+2
source

Source: https://habr.com/ru/post/959168/


All Articles