Getting Wrong Screen Sizes in iPhone 6/6+ - ios

I am getting wrong screen size in iPhone 6 and 6+ by using
[UIScreen mainScreen].nativeBounds
and
[UIScreen mainScreen].bounds
In both case , i am getting wrong screen size.
So, I have added launch screen for iPhone 6 and iPhone 6+ then I get correct size of screen in iPhone 6 and iPhone 6+.
But another problem is that My App UI displaying wrong. All Screens of app left right padding. See below image :
If I remove launch screen for iPhone 6 and 6+ then App UI is displaying right as displaying before like below image :
In above image, no right padding.
I have also check by adding launch screen but that also getting wrong screen sizes.
Note : I have used AutoResize in app and It is working good in whole app.
I have also do so much googling to find out actual problem but unfortunately can't get it. Thanks so much in advance If anyone help to sort out that problem.

Sorry, did you check Settings -> Display and brightness -> View (Standart)?

One of the possible patch to identify your screen type is by getting the scale of your screen. You can use the following code : [UIScreen mainScreen].scale;
This will not let you know the exact screen size but will allow you to know what is the scaling. This method might be helpful where you need not to code individually for different screens and majorly do not want to convert your entire code to autolayout.
To know the scaling factor of different screens refer to following link : http://www.paintcodeapp.com/news/iphone-6-screens-demystified

Related

Content is being cut

Why is it cutting the sides off? It looks perfectly fine in storyboard. I set the size to 4.7 inch iPhone and applied the necessary constraints, but this happens.
Sounds silly, but make sure you have the correct resolution of splash screens set up. On certain phones I've noticed that the incorrect size would clip the screen to the size of the splash screen. Apple is your friend it just werks and all that.
So it's a duplicate of this Why [UIScreen mainScreen].bounds] is not returning full screen size?

Wrong values for self.view.frame even after adding Launch Images and a Launch Screen

I have been frustratingly stuck on this issue for the last 2 days. I have gone through and followed most of the StackOverflow questions regarding adding Launch Images and/or a Launch Screen so that the app isn't zoomed on iPhone 6/6s and iPhone 6 plus sizes.
I have made sure to add the Launch Images with correct dimensions, 750x1334 and 1242x2208.
Even after doing this and adding a Launch Screen, when I print self.view.frame.size.height and self.view.frame.size.width, it is always 568 and 320 respectively.
Can someone please help me with this. I don't know what I'm doing wrong.
The first screen that is shown used to be a subclass of another UIViewController called BaseViewController but not I changed it and made the first screen a subview of UIViewController.
I am not sure if I have missed some important step in allowing the app to function on bigger screen sizes.
Any help would be great!
I look forward to your responses. Thank you in advance!

Views in storyboard do not resize properly on iPhone 6

I've checked a lot of different websites and stackoverflow answers, and I'm still stuck.
I developed an app for iPhone and iPad targeting iOS 7.1. I have two storyboards, one for each device. The app only displays in portrait mode. I cannot seem to get the app to display full screen on the iPhone 6 simulator.
I've tried numerous things, I followed the advice linked here by adding a Launch Screen, setting the iPhone storyboard to auto layout and "use size classes", and . Not only does that not affect the size, but the Launch Screen doesn't seem to scale properly either. If I get it to fit the iPhone 6 it doesn't fit the iPhone 5 properly.
I've tried adding the proper launch images and I don't get any errors saying the wrong image resolution is present.
I've used the storyboard as a Launch Screen described here.
Now, when I switched to "use size classes" I could manually extend the objects in the views to match up with the size of iPhone 6 (I have not tested it for 6s) but that makes it extend past the iPhone 5 boundaries. The only thing I can think of right now is to create another storyboard and detect if it's iPhone 6, but I would really like some other ideas.
Here's what it looks like for iPhone 6:
And here's what it looks like on iPhone 5:
Best advice i can give u is
Use default size class , the classic 600x600 and then use Auto Layout
Or do the reverse, take a 3.5inch size VC and apply Auto Layout on it. Everything will present itself quite perfectly if you can apply the right constraints
Here is a link for an awesome Autolayout tutorial

Black bars simulating iPhone 5 - Xcode

When running the iPhone 5 simulator 2 black bars appear making it the resolution of the iPhone 4(s). My question is: how am I able to use the full screen resolution? (it also creates black bars all around the app when trying to simulate an iPad)
Now, I know this questions has been answered multiple times here on stackoverflow, but all of them give the solution of adding a Default-568h#2x.png launch image. I want to make use of the LaunchScreen.xib instead of creating all the seperate launch screen images.
Anyone got a solution for this?
Thanks!
- Merijn
You must use a specific launch image to take into account the 4" inches screens...
or either way you can use a specific Launch screen with autolayout constraint for example if you don't want to add too many launch images : http://useyourloaf.com/blog/2014/12/24/using-a-launch-screen-storyboard.html

How do you disable scrolling? I want my app to be displayed on full screen

I have been designing a app on xcode over the past week but I have encountered a problem. When I run the app on iPhone simulators (3.5 inch and 4 inch) my game is scrollable when it shouldn't be. I want my app to be displayed on full screen of iPhone with no scrolling.
I have not changed any of the settings in storyboard so I am starting to think maybe its a problem with the simulator?
Anyone have any ideas of what's wrong and how I could correct this? Any help would be appreciated
The question is pretty vague (how are you "designing" the game? With SpriteKit? UIKit?) but here is some reading material that should get you pointed in the right direction:
- AutoLayout
- Autosizing
I think this is just an issue with the simulator. It seems like if the resolution of the screen is below a certain amount, it shrinks the simulator window to fit, and then you have to scroll around inside the simulator to see the whole VIEW. I noticed this issue because my Macbook has a small screen. But when running on an actual device, it takes up the whole screen as it should. You could try using different simulated devices with smaller screens to see if it still does it.

Resources