I need to move a textarea and button right above the virtual keyboard, like so:
For that, I need to know the height of the keyboard. I have tried using the $(window).height() method, but oddly enough, it doesn't change even when the keyboard is opened.
Any suggestions?
For Iphones
iPhone 4S (and earlier) Portrait Keyboard (English) 320 x 216 pts
iPhone 4S (and earlier) Landscape Keyboard (English) 480 x 162 pts
iPhone 5 Portrait Keyboard (English) 320 x 216 pts
iPhone 5 Landscape Keyboard (English) 568 x 162 pts
http://www.idev101.com/code/User_Interface/sizes.html
Related
I have an iOS App originally developed for iPhone 4 and 5.
After doing some updates, I tried to run it on iPhone 7 (Simulator), the Views won't fill the screen any more. They (inclusing the title bar) leave a black margin on the right and the bottom of the screen.
I found a lot of similar posts regarding iPhone 5, where an appropriate launch image was missing. Yet, I have included all possible launch images in their correct sizes as asset catalogue (shows no warnings any more, puh), and the when the app is launched, the launch image is fullscreen.
The Layout/View is set to auto-layout, and resized well, if I change the size in the InterfaceBuilder.
Why does the View not scale on iPhone 7 ?!?
Try to add splash screen image to project with following name instead of assets folder.
Default-568h.png 320 x 568
Default-568h#2x.png 640 x 1136
Default-667h#2x.png 750 x 1334
Default-736h#3x.png 1242 x 2208
Default.png 320 x 480
Default#2x.png 640 x 960
Found Solution
In the View's "Attributes inspector" tab, in category "Simulated metrics", the attribute "Size" was set to "Freeform". After changing this to "Inferred", the sizing worked.
Note, that this seeting shall be checked in the MainWindow, as well. And it may require a build-clean, before this change reaches the Simulator.
Changing the "Size" also influenced the device selector in the InterfaceBuilder (the symbols for different iPhone and iPad models), making it actually adjust the size when clicking an iPhone model or changing orientation... Before, nothing had changed when clicking a model from the selector.
yes that was also working but in this question launchscreen are mentioned so i have gives answer according to that point.
Ok I've finally taken the plunge into autolayout using Xcode 8.
I might conceptually have the wrong idea. However I have a view in IB which has 2 labels a button and an imageview dead center in the view with dimensions 300 x 300 for 6plus and 6 devices.
What I want to do is vary the imageview size for iPhone 5 (SE) so I click Vary for Traits and select height and width then change the values to 150 x 150 click done and the all looks good looking at iphone 5 (SE).
Now flicking back to 6plus and 6 its also resized to 150 x 150 but I want the image size to remain as 300 x 300. Again I may have the wrong idea completely.
I thought the whole point in this is that its varying the size dependant on what is selected i.e. varied.
Vary for traits or size class is not used to change autolayout for different devices, rather it is used to change layouts for Regular and Compact size of (width or height or both).Too many devices come under regular width like ipad pro iphone 7 plus, etc.
same iphone se and iphone6 in portrait mode has same width thats is Compact.
So when you change for one it changes for both.
When you choose vary for traits and select width+height checkbox it shows some devices in blue box it means all those will be effected.
Better do it programmatically, check device type and set size according to it.
So i'm making a universal devices app but not sure which size classes to use for iPhone and iPad but i'm making the app Portrait and PortraitUpsideDown only.
Do I use 2 size classes one for iPhones and another for iPad or do I use 1 size class for iPhone and iPad?
What size classes do I use if I want iPhone and iPad in Portrait and PortraitUpsideDown?
you have to use different size classes for different layout .According to apple it has 4 type
for iPad (landscape and portrait mode)-regular height and regular width
for iPhone (portrait) - compact width and regular height
for iPhone in landscape(except iphone6 plus and iPhone 7 plus)- compact height and compact width
for iphone6 plus and iPhone 7 plus (landscape mode) - regular width and compact height
---> you are using only portrait mode so you can use
Regular height , regular width for iPad portrait
Regular height , compact width for iPhone portrait
for more information
https://medium.com/if-let-swift-programming/size-classes-ipad-portrait-landscape-55f59173c65a
Portrait and portrait upside down are the same in terms of size classes. Compact width and regular height is for all iPhones in portrait and regular width/regular height is for all iPads in either orientatation
I'm having real trouble here for some time. I'm not using size classes (app is for os 6 +). I'm using auto layout, I don't want to have multiple storyboards for each screen size. For 3.5 and 4 inch screen everything is ok. For 4.7 + inch it's not. So to show you what is the problem. This is for 3.5 and 4 inch screen:
This is 4.7 inch screen:
As you see, right arrow goes to the left. It has Vertical Center in container and its height is 28x28. It has right constraint 8 points like this (I've unchecked Constrains to margin):
I cannot make it work for iPhone 6 and iPhone 6 plus. What am I doing wrong here?
I made an xib in XCode 6 and put a imageView on it in ANY | ANY of frame say : (0,0,20,20)
Then, I resized the same frame in Compact | Regular (For all iphones in portrait) : say (0,0,30,30)
Once I am checking same in debugger for iPhone 6 and 6 plus, it is taking image of frame (0,0,30,30).
But it is working fine for iPhone 5 and 5S
What is the reason for this ?
iPhone 6 and 6 plus resolution is different than 5s. So it will increase image views frame. If you want to set image with fixed height and width, you need to set constraints as per requirement. Happy coding..! :)