Support of iPhone 4-inch screen by storyboard - ios

I created a new project in XCode 5. And I run it on iPhone 5 (which has 4" screen) and a view doesn't cover all screen, but rather squeezed in 3.5" box (there are two black bars around my view)
I went to Main_iPhone.storyboard and checked that:
Use Autolayout is turned on on View Contoller
Use Autolayout is turned on on View
I tried Simulated Metrics, Size: Retina 4-inch Full Screen, Freeform and Inferred.
I tried to use button at the button to switch to Retina 4-inch form factor and 3.5-inch form factor.
Nothing makes a difference and it still shown as 3.5" (black bars around my view).
How can I make sure that iPhone storyboard occupies whole screen on iPhone 4-inch phone?
Update 1
None of solutions in this question: Xcode Storyboard displaying the new iPhone 5 screen size? solved my problem. BTW. That question was for pre XCode 5.

To enable your apps to work with iPhone 5, I suggest you to do two things.
First you need to add a retina version of the launcher image. It should be named Default-568h#2x.png.
And second use Auto Layout and make sure you have your autoresizing mask set up correctly for all your views.

I had the same problem, could not resolve it by any of the above methods. So what I did is copied the Content.json files from old project (where 4-inch was working) into the Images.xcassets Applcon.appiconset and LaunchImage.launchimage directories respectively. Then selected in the project setting in General under App Icon selected Source as AppIcon and in Launch Images in Source selected LaunchImage. It worked. Maybe useful to someone.

Related

Window size small on iPhone 5/6

I have having ass issue with an iOS8 app, I use auto layout but not size classes in my storyboard. My app works as expected in iPhone 4s and on iPhone 6+ but when viewed on an iPhone 5/5S/6 the window seems to be the wrong size, I get a black border at the top and bottom of the screen. I have attached a screenshot below. What could cause this? I have never encountered it before..
You are missing the correct size of launch screen for 4" and 4.7" devies. If you have them in your project make sure they are in the list of launch screen in te info.plist. If you are using image assets make sure they are present in the LaunchImage section.

xcode only running 3.5 inch screen [duplicate]

We have an iPod app built with base SDK as 5.1.
App has a tabBarController with three tabs and each tab has a UIViewController to load a different view.
The app works fine for iOS 6.1 and iOS 7 (3.5 inch display) simulator and device but when we run the app on
iOS 7 (4 inch display simulator) or device we are getting black bars at the top and bottom of the view screen in all three tabs.
If anyone can suggest reason for this or some feasible solution to this problem, it would be really helpful for us.
Thanks
First thing is that you must add the required default image for 4 inch screen display. Check Properly in you project have image with name Default-568h#2x.png (640 × 1136 pixels)
This Default-568h#2x.png is Necessary for Support app in 4 inch Screen display
Ones you add this image in to you working Project, Remove old Build from device or Simulatore, clear Project and re build and check Hope you issue will solve.
Edit:-
After fix the black Bar issue you can check the device like my answer Give here check this:-
Detect device type
you have two choice if you can't use AutoLayout
First
Create two xib with same class one for 3.5 inch screen and one for 4 inch screen set using macro with checking which screen appear.
Second
Set Self.view frame using macro with checking which screen appear.
There are also other methods you can use for set self.view frame as using window frame or UIScreen
My problem was I accidentally deleted the value found here:
I added back LaunchScreen, and made sure there was a LaunchScreen.xib. Maybe it will help some others.
Ive had the same problem - black bars at the top and bottom. It was simply solved by setting the drop down in "App Icons and Launch Images" to Main_iPhone:
App Icons and Launch Images Screen Shot
I was facing same problem . I just added launch image and it worked for me.
XCode->Click on Project File -> Select Target-> App Icons and Launch Images -> Add launch image source
This worked!
Pay attention to Step#5 and Step#6 below:
1.In xcode, Click on the Project file in Project Navigator
2.Click General tab
3.Type "Main_iPhone" in the Launch Screen File field
4.Save
5.Remove the app from device or simulator
6.Then in Xcode go to Product Menu and then select Clean
7.Build again

How to prevent Xcode/Interface Builder from auto-shifting view down?

Without modifying any code in a new Xcode 6.0 Single View project targeting iPhones running iOS 7.1, the result on my testing iPod Touch 5th gen device shows a shifted version of what's in Interface Builder. It appears the shift is downward. I've already tried turning off Auto Layout and Size Classes, and resetting all UIView coordinates to (0,0), but still the battery symbol and upper bar is too far down! Please see pictures below for Interface Builder screenshot, and device screenshot. The question is how can I keep what I see in Interface Builder, and stop the iPod from shifting down the entire UIViewController? Thanks!
UPDATE: In the end, I had to go into project build settings, click on the app under Targets, and change Launch Images Sources to a new folder it titled "LaunchImage-2" and delete the Launch Screen File field, which was set to Launch Images.
If you don't add the Default-568h#2x.png
then xcode build the project of size 3.5 inch and shows black patch at the bottom.
So you have to compulsory add the image with name Default-568h#2x.png of size 640 x 1136
If you use an empty Asset Catalog for your Launch Images, the iPhone 5's screen size is supported (without having to include any image files at all).
It seems that you need to add the default or launch images into the project. Your project should be using image assets, so there you will see launch images and you need to supply images of appropriate sizes, preferably for all iPhone screen sizes.

How can I get the Xcode storyboard and the iPhone Retina (3.5-Inch) simulation to use the correct xcassets images?

Weird problem here which may be a bug in Xcode...
Using an Xcode 5.1.1 storyboard with auto layout, I am working on the design of a view controller that contains a full iPhone 4 sized UIImageView that references an xcassets image set. The xcassets image set includes 1x and 2x iPhone 3.5-inch images, and an iPhone 4 R4 image.
Problem 1: Once I set the Image View Image for the UIImageView in the utilities panel using a View Mode of Aspect Fit, the storyboard shows the smaller iPhone 3.5 image with white spaces at the top and the bottom of the view instead of the iPhone 4 image which would fill the entire storyboard representation of the view, as they are the same size since Xcode infers an iPhone 4 sized screen in the storyboard.
Problem 2: If I ignore problem 1 and run the program using the iPhone Retina (4-Inch) simulation, the applications selects the correct image size from xcassets and everything seems fine. However, if I run the simulation using the iPhone Retina (3.5-Inch) simulation, the applications also selects the correct sized image, but pushes the images down and display white space at the top of the page.
Before I start hacking around these problems, I thought I would reach out and see if anyone else has experienced either of these issues. Any help will be greatly appreciated.

Simulator/device UI differs from storyboard

I am using Xcode 4.5.1 to create a very simple, single view iPhone app. I've laid out the view as you can see in the IB image. (UIViewController, UIView, UIButton, UITextView).
When I run the app in the simulator (or my phone) it looks like the second screen shot.
I don't understand why the simulator UI doesn't look like the one I created in IB.
What am I missing?
Thanks!
If you look you are using the iPhone 5 size layout in your storyboard file. To change the dimensions between iPhone 5 layout and the standard iPhone size
Click on the icon in the lower right hand corner of the storyboard:
Alternatively, if you want to see the layout in a iPhone 5 simulator. In the iOS simulator go to Hardware > Device > iPhone (Retina 4-inch). This is the iPhone 5 layout. However, if you do not have a retina displayed computer. The iPhone will look like a really big iPad.
It looks like you have an iPhone 5 sized layout in Xcode and a iphone 4 in simulator. Check the constraints on the dark grey vs bottom views and make sure that they'll resize how you want.
Hey so here is another method.
My Problem:
1.My Storyboard was showing a fat rectangle that didnt look anything like a iPhone. Then when I'd run the simulator all the element were cut off and not in the right position.
2.Simulator took up the whole screen.
Resolution:
1. Make sure you Storyboard is open and displayed, click on the frame so that it has a blue highlighted border. Then on the Utilities manager (on the right) click on "Show the Attributes menu". The very first item should be Simulated Metrics. Choose the size that best fits your screen/needs.
2.Follow Adjusting the XCode iPhone simulator scale and size I scaled it down to 33%
Best,
Nate

Resources