Two storyboards for different iPhones (3,5 and 4') - ios

I write application for a 3.5-inch on one storyboard and for 4 inches in another stroryboard. As a delegate at startup check under what device is enter in and from there method can be carrying launch storyboard or iphone 4 or iphone 5
(because the larger screen iphone 5, can I expands the functionality?)
Is it correct?

You don't have to do this. There is a button in the bottom left of interface builder that lets you switch between screen sizes, and using autosizing will adjust it for both screen sizes.

You can also use Autolayout too

Related

XCode: How to resize views, buttons depending on the screen size of the device?

My app contains several view controllers. I have used auto layout to add constraints to my labels, views and buttons.
This is how one of the screens looks like on iPhone X.
How the sam screen looks like on iPhone 8
As you can see, the disclaimer text in the iPhone 8 image is not fully showing.
How would I get it to show on iPhone 8, iPhone SE, etc?
Thank you

different ui items alignment for tablet

I'm new to ios(android dev). I'm using storyboard, and autolayout.
To optimize application for tablet, i used sizes in storyboard regular width regular height.
I want to align ui items on ipad different than on iphone mode. For example, i have a table of textfields that occupy full width on iphone. On ipad i want to place two or three textfields in one cell. How can i make different ui implemetation for ipad, so the logic shoudl stay the same.
I watched https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/LayoutandAppearance.html#//apple_ref/doc/uid/TP40006556-CH54-SW1
But there is no answer there.
Jenya Kirmiza,
Size Class is what you want :) Size classes were introduced with iOS8 in order to avoid the multiple storyboards for universal applications and yet provide an easy way for the developer to design differrent UI for differrent Devices :)
I expect you to know SizeClasses, In case you are not aware each device in its various orientation falls to one of the sizeClass defined by Apple.
One thing important to note here is that iPad in its both the orientation falls to Regular x Regular size class
Where as all iPhones other than iphone 6S and iphone 6s + will fall to
Copact Width x Regular Height - Portrait mode
Compact Width X Compact Height - Landscape Mode
Iphone 6s and 6s + falls to
Copact Width x Regular Height - Portrait mode
Regular Width X Compact Height - Landscape Mode
Now that you are equipted with the information of all size classes lets nail this issue down. When you open the story board at the center of the screen there is option to decide the size class :)
So go ahead open up your story board when you see it by default will be in wAny wAny mode What it means is whatever the components you add and add the constraint to it will be applicable to all the sizeclasses irrespectively.
Hence you see the textField added at the center of the screen appears center in all the devices may it be iPhone ot iPad.
For explaining Ill add two text fields named Firstname and LastName :)
Lets start adding textFields and constraints to them in storyboard keeping wAny wAny mode.
Now I have added two textFields one below the other covering the whole width of the screen in any any mode :) This will work fine for me in all iPhone devices :)
But I want to allign them side by side in iPad. Now we know that iPad belongs to Regular x Regular sizee class in both the orientation :)
So Simply change the size class in storyBoard
Now when you see you will see two textfields added one below the other already :)
Now select those textfields we want to align them differently isnt it :) So will have to remove the constraints already added to them :)
Now move them place next to each other add constraints properly :)
Thats it now run on iPhone and iPad :) You will textFields one below each other in iPhone and one next to other in iPad :)
iPhone Output :
iPad output :
Hope this helps :)

Is using constraint/auto-layout on iPad a mandatory?

All iPad screens, iPad 1, iPad 2 ... , iPad Retina and Mini iPad have the same screen ratio. width/height or height/width or width:height
So, Why do we need to use constraints for the iPad views?!
I also believe that in interface builder when you select the view controller, you can view it as iPad or iPhone. there is many iPhone options but only one iPad option. you can do that by clicking the size drop down list in the Attributes Inspector.
Is there any of the iPad screens that have more or less screen points comparing to others? "Screen Points" not "Screen Pixels" if yes, Which one is that?
You don't have to use auto layout, but it's a good idea to. Once you understand it it's faster to work with, more flexible and very powerful for animations. You should also consider device rotation and usage for things like multi-tasking (ios9, use size classes too).
If you Design your Screens in Width Any / height any than your design will run on any iphone and Ipad Screen with autolayout. And it's a good practice too. if you want any change for iphone / ipad screen than you can remove that constraint for particular devices.add particluar constraint for particular devices.

Displaying different images for iPhone 4 & 5

This seems to be an interesting problem that I'm getting. I'm developing an iPhone app for iOS 6+ devices and optimizing the images for both iPhone 4 & 5. Now I have implemented this into my project: Xcode 4.5 background image iPhone 4, 4s, 5
The problem is in interface builder I'm designing the UI with the iPhone 5 screen, so the UIImageView is 320x568. But when I test on iPhone 4, the image is being stretched and looks terrible. However, the specified image for the iPhone 4 screen is displaying, i just want its dimensions to be 320x480
Hope someone can help!
From the inspector view in the interface builder, you can edit the stretching behavior of the view when the size of the super view changes. You can click the red arrows inside the square to control that.
Also I suggest that you check UIView contentMode. You can edit that from the inspector view in the interface builder "third tab from the right.
In the UIImageView's inspector, try playing with the Mode property. The Aspect Fill or Aspect Fit may get what you're looking for to handle the different screen sizes.

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