UITableViewCell ContentView size problem for plus size iPhones - iphone

I have UITableViewCell with Xib file. Everything looked fine until i tried my cell with plus size iPhones such as iPhone 7 Plus, 8 Plus and XS Max.
Cell height is 476px and it's contentView height is 475,5 as usual. However, when i tried plus sizes cells contentView height is 475,67px. What da heck is wrong with Interface Builder?
iPhone SE, 7, 8, X, XR
iPhone 7 Plus, 8 Plus, XS Max

If this tiny margin is causing such a big trouble then there are a couple workarounds you could do to fix it.
** Both workarounds will require code checking for plus sizes iPhones. Check here.
Detect if the device is iPhone X
Create a separate cell to use it with plus sizes iPhones and set it's height to whatever is adueqate.
Or manage (heightForRowAtIndexPath) to return the desired height for plus sizes iPhones.

Related

IOS / Swift - How to adjust font size and margin size for each devices screen sizes with autolayout

Coming from the Android world, I'm trying to create my first IOS app in swift.
Actually stuck to build interfaces that are adpative to all screen sizes from Iphone 5s to Ipad 12.9".
Autolayout works well except that I can't find how to easily adjust font size and margins for each screen sizes.
Maybe I've missed or miss-understood something in my research but my question is :
How can I have big margins/font sizes on big screens and smaller margins/font sizes on smaller screens ?
Is it possible to have like a constant for a margin for each device or range of screen size in one place so I can easily change it ?
Update :
I forgot to mention that I also tried variations on constraints and font size but theres just a few options between "regular" and "compact" and if you need to change a margin you have to change it on all your elements it's seems crazy..
In Android there's a dimension xml file by each screen size/resolution you want where you can have contants and assign them to each element you want.
I can't figure out the logic behind IOS here
Thanks in advance

Xcode 7: UITextview doesn't aligned properly for 3 different sizes iPhone screen

I am trying to use adaptive layout in Xcode 7.1 for iPhone app. I am using 3 sizes iPhone device 5.5, 4.7 and 4.0 inches. When I added a background UIImageview, it fits nicely on all 3 iPhone screens. Please refer attached screenshot. I did pin option to Add 4 sides constraints with 0 values. Background fits to all 3 iPhone sizes screen fine.
Now, I am trying to add a UITextview in all 3 iPhone sizes screen. Now, this text view doesn't fit properly in all 3 iPhone sizes screen
Please find the screenshot reference below. How to make this textview properly placed on all 3 iPhone screens just below Employee ID label?
Follow this image and set your constraints like wise....
You have to set constraints to fit textfield properly. Firstly you have to set size class before setting constraints to handle orientation. like size class with respect to device size in this screen shot size class RH/CW set for portrait orientation. And set set constraints to fit UITextfield

Autolayout - How to Change width spacing between iPhone 6 and Plus

Ok, I have been pulling my hair out for a few days now and thought I would ask the community how to deal with width sizes or the gaps between buttons in xcode 6.4 or 7 (tried them both).
Ideally I want 2 buttons near the bottom and they need to scale properly based upon iPhone portrait mode.
I have added the 1x, 2x, and 3x pngs of the button to the asset system and my auto layout is set for wCompact hRegular which from what I understand allows you to target all iPhone devices in portrait mode.
So after adding my buttons I had it do add missing constraints which added a few and seemed to work pretty good but the issue im running into is the gap spacing between the 4.7 inch and 5.5 inch and how to adjust each one of those separately in interface builder if possible.
See the image below where I outline the gab space and its quite huge for the 5.5 inch.
Also it would be awesome if I could use bigger images for the bigger phone but thats another subject I guess.
Since I cant post images here here is the link to the story board
Take a look at this repository..
https://github.com/mahesh-agrawal/Test-Autolayout-Buttons-Spacing
i have added required constraints to make the gap between the buttons dynamic for all devices. also i have made the width and height dynamic by giving proportional width height.
I have taken two views and given them horizontal spacing 0 and equal width and leading and trailing required for each. and then i have taken two buttons in each and managing width of button with proportional to the views so they will increase accordingly and also the gap will increase accordingly. Test in all devices.

Xcode iPhone 4/5 Screen Size Both

I am making an application in Xcode, and I need to make it for both iPhone 4 and 5. But since the iPhone 5 has a bigger screen, it messes my application up.
Once I place the labels for the size of iPhone 4 and then test it on the iPhone 5 the labels are all misplaced. Is there a way to make them stay?
You can use iOS 6's new autolayout feature (if you want to be iOS5-compatible, you can still have autoresizing masks).
You need to position your labels based on the View Height of the device(don't have to worry about width, since iPhone 4 and 5 both have the same width. But this would apply for a universal app targeting iPad and iPhone).
For instance, if yours is a View Based Application, find the view height of the superview using self.view.frame.size.height, and determine all label/view placements based on this property.
And test for both screen sizes on the iOS Simulator.

Best way to set the size of UIViews size in iPhone application (so everything looks good on both Retina and older display)

I have the following problem. My application has a tab bar at the bottom and a simple TextView above. In order to fit well TextView above tab bar I had to resize it (I did it through Interface Builder) - I just set height to 401px (usually I hate to do such things).
Then I have tested application on the simulator, to my surprise everything looked o.k. on both standard iPhone display and Retina display. Since I do not have an iPhone I am wondering if everything would look good on the real device as well.
So, my question is: how to set the UIView size so it follows best practices and, what is more important, GUI looks good on both Retina and older display.
BTW: I know how to deal with icons and graphics to make them look good on Retina and older display, I've read all the relevant stackoverflow posts on the subject :)
Size is same on both standard and retina display. It's measured in points. Number of pixels depends on display density.
Pixel != point.
Look at UIScreen scale property. For standard screen it contains 1.0 and 2.0 for retina (iPhone 4). It can contain different values, even not integers.
If you set size UIImageView size to 100x100, it will have same physical size on standard and retina display. But on retina, it will show you much nicer image, because 100 points contains more pixels.
The units in Interface Builder are now interpreted as points not pixels. Therefore it will look the same on both types of displays. On old displays 1 point equates to 1 pixel. On Retina displays 1 point equates to 2 pixels.