Maintain same tableviewcell height in different phone size - ios

I have a table view which contains the setting that looks like current iPhone setting page.
I want the tableview to remain the same size as well as for the image icon for each setting. Much like in iPhone 5 and iPhone 6, even though iPhone 6 is much bigger but the icon size remains the same as iPhone 5.
I've added iPhone 6 and 6+ launch screen and for the image icon, i've set constraint for height as well as aspect ratio. In code, i didn't declare heightForRow and in storyboard, i leave height for tableview cell as default.
Is everything i did correct? or am i missing something? i'm doing the storyboard in wAny hAny size class.

If you do not change the value you have put for the height of the table view cell, will remain fixed for all devices.
See the image for details.

Related

UIImageView sizing in AutoLayout + Size classes for all devices

I'm working on app and will for 1st time use auto layout/size classes. Today my first day learning it and I understand constraints now and how to place the images where I want them to be on every devices from iPhone 4s to iPad PRO.
As my main storyboard in Attributes inspector i'm using INFERRED size. In show Assistant Editor, Preview, i'm using all device sizes.
In my inferred storyboard i'm using a UIImageView size 170 Width, 230 Height. Then I use AutoLayout to make it center of every device screen in preview.
Now the issue is this UIImageView covers HALF of the size of iPhone 4s preview but only about 1/5th the size of iPad PRO. How do I alter the size of each UIImageView to the size that I want them to be in each device without changing that centered position of each UIImageView in the preview devices?
You need to first set up your constraints properly and then choose the type of scaling you want.
Set up your constraints:
Click on the Pin icon |-[]-| at the bottom of the screen. Turn on all four orange I-beams. Set the four constants to zero.
Uncheck the Constrain to margins checkbox and click 'add 4 constraints'
Then set your scaling:
Click on the Image View you added to your View Controller.
In the Attributes Inspector on the right, choose your image.
Set the Mode of the View to Aspect Fill (fill entire screen cropping top/bottom or left/right as necessary) or Aspect Fit (letter box image so that entire image is shown uncrossed).
That should work
Maybe you can use a pending or proportion constraints instead of width and height constraints.

Autolayout change height of the view when app starts

I have UIViewController on storyboard.
On the image you can see top gray is simple UIView while bellow is UITableView.
And I set uiview to be 150 height.
I use autolayout.
Problem is that when I run app on iPhone 6 uiview height is about 40% of the UIViewController.
From some reason it's height is larger than 150.
Can somebody explain me how can I setup view so I have UIView always the same size?
I think the problem is with your view height....you can not give static height.... see the images and check out where you missing out....
and the o/p is in 4.7 , 5.5 , and 4 inch is
for all the height of view is looking same....that is of 150 height
Have you included an iPhone 6 launch image? My guess is that the iPhone is resizing up based on the resolution of the 4" screen. Include either a static launch image, or a dynamic, xib-based one, and I think that should fix your problem.

How to handle iPhone 4s, 5 and 6 screen size, and make all the contents look the same across al the devices

I am using Xcode 6.1 and in one of the views I have, contains many labels. However, these labels look different in each different devices. Although I have add constraints to all the labels, but still facing the same issue.
How can I get the same view layout across all devices?
How can I make the width and height for each label is flexible, depends on the screen size?
Do I need to design different xib for each device?
The following images showing the result am getting, with auto resize enabled, and constants been added.
on iPhone 6
on iPhone 5
on iPhone iOS 7.1
We have provided with a simple solution . Using Aspect ratio constraint we can get a relative look in all device screens.
I had the same issue and I found this >>
http://mathewsanders.com/designing-adaptive-layouts-for-iphone-6-plus/
So when designing for lowest to highest screen resolution we can't set a specific width and height for all controls as it may look weird. So using this constraint we can have a relative look for all screens.
If you don't want to use constraints or you want to keep the same width & height , you can add scrollview to hold all controls. For that you can set a resizing frame for scrollview with fixed content size .
To solve this...
1) Go to xib file and uncheck the Auto layout
2) Then set the autosizing manually in the following manner for each and every subview.
Use self.view.bounds.size.width to get the width of screen, then use relative value to initialize all labels.
One soultion is that you can Design a story board for each screen size like one for iphone 5, one for iphone 6 and one for iphone 6+ and in your AppDelegate method "didFinishLaunchingWithOptions" you can get the screen size and popup corresponding storyboard
in this wasy you can set different constraints according to different screen size

ImageView width more than cell width in UITableView Cell - XCode 6

I am developing an application in XCode 6 for iOS 8. I am not using auto-layout. I am trying to put an ImageView in a UITableView cell. When i run the app on iPhone 6/6 Plus:
The size of the imageView becomes double than my cell size if i check all the auto-resizing options.
The size of the imageView becomes lesser in width if i uncheck all resizing options except for the left one.
Is this some bug in XCode? Because I think, if i check all the auto-resizing options, and use scale to fill for the imageView, it should scale up and down accordingly, rather than going out of bounds of the view and cell.
All help is appreciated.
I ended up finding out that it all depends upon the splash screens you have added. AutoResizing proves troublesome on iPhone 6 and 6+ if you have splash screens for them.
But if you remove those splash screens and only keep a splash screen for iPhone 5, then your app will properly scale up and down, hence the bug will be resolved.

How to make a view in a XIB/storyboard size to the phone dimensions without using auto layout

I have a scroll view in a storyboard and the app is to run on iPhone4s and iPhone5s with iOS5 and iOS6.
I initially created the storyboard and was running on an iPhone5 and now I'm testing with an iPhone4.
Isn't there a way of just using a single storyboard for both the iPhone4 and iPhone5 and the when views etc. will automatically resize themselves depending upon the device, or do I have to use two separate storyboards?
I've tried numerous things, such as changing the simulated metrics size and many others but I can't find anyway of the view changing its size automatically - as I created the storyboard initially for an iPhone 5 the view now seems stuck at a 548 height when loaded. SUrely there must be a way of specifying in the storyboard that its height comes from the device? (Its height is the full screen less the status screen).
Further details
There is UIScrollView inside a UIView, the UIView will resize, the UIScrollView will not:
Yes, you can do it in the "Size Inspector", inside the Utilities menu. There you can set the autosizing and origin of any visible element.
This works in iOS 5 and 6 and it's not required to use the Autolayout, which is only for iOS 6.
Size inspector:
Second screenshot:
You have to use two storyboards for iphone4 and iphone5. Then you can check the device size to load the .xib according to it.

Resources