Different frame heights on iOS 7 and iOS 8 - ios

So basically I am trying to dynamically change the height of a view based on three different labels inside of it. I use _labelName_.frame.size.height to get the height for all three. This works great in iOS 8, however in iOS 7 one returns 17 (should be 33), the other two both return 0, and they should be 22.5 and 16.5.
I'm at a loss as to why iOS 7 and iOS 8 are returning different frame heights, any help would be greatly appreciated!
Edit: Did a little debugging. Turns out, the frame heights are 0 in iOS 7, but not in iOS 8. It seems that layoutSubviews is working differently on iOS 7 than it is on iOS 8. Any reason that layoutSubviews would lay out the subviews differently between the two versions?

Try calling [_labelName_ sizeToFit] after setting the text and before accessing the frame

Related

UITableViewAutomaticDimension not working on Xcode 11 and iOS 13 with trait variations

I have view in xib that registered to tableView and calculate height through UITableViewAutomaticDimension. And all worked fine before update to Xcode 11 and iOS 13, now height small and incorrect.
What I noticed, if I remove all constraints trait variations it appears to work again. But if I add at least one trait variation for constraints(no matter horizontal or vertical) As on this image
Even with two checks, it breaks. But such variation working good, not breaks layout
.
Maybe bug in Xcode or something. Has anyone encountered this problem?

Autolayout differences between iOS 8 and iOS 9

If I run the same code on iOS 8 and iOS 9 the layout comes out differently. The icon and label should be even.
I'm using a custom font so I'd assume the font size / height is the same in both OSes. If I adjust the spacing constraint to be right on 9 it shows up wrong on 8.
Any ideas?
Update
Here is the existing constraint:

UITableViewCell's height different on iOS 8 (compared to iOS 7)

Something is troubling me. I have a UITableView with cells that contain images. When using the iOS 7 simulator, the images gets constrained to the cell's height. When I tested it on the iOS 8 simulator, the cell expanded to the height of the image, and it is kinda buggy. Buggy because the height may change back to the height which appeared under iOS 7. Can someone kindly enlighten me please =D
My app is built using iOS 7 by the way.
Seems like all I can do for now is to use this:
self.tableView.rowHeight = 44.0;
Do let me know if any of you geniuses out there got something better =D

UIWebView becomes too big when using iOS 6/7 Deltas

I have a UIWebView in my app. Due to the differences between iOS 6 and iOS 7, it has be a slightly different size. I'm trying to achieve this with iOS 6/7 deltas in IB. It seems like this should be easy, but it's not working right. On iOS 6, the UIWebView needs to have a height of 373 and on iOS 7 it needs to have a height of 393. However, when I set the height in iOS 6/7 deltas, it's fine on iOS 7 but when it's run on iOS 6 the UIWebView's height increases to 745. That is way too big. I've also had this problem the other way around (where it's fine on iOS 6 but way to big on iOS 7). I can't figure out why this is happening. Does it have something to do with the way iOS 6/7 deltas work? Is there another solution?
Here are my deltas:
With "View as iOS 6.1 and Earlier" enabled:
With "View as iOS 7.0 and Later" enabled:
Also something I should have mentioned before is I'm not using Autolayout as I want to maintain compatibility with iOS 4.3.
You are misunderstanding how deltas work.
"Delta" means the "difference", as you have used when setting the y value.
If the views have the same height, simply set the delta of the height to 0. If the height is different, set the delta to the difference.

Interface Builder, frame changes on IOS 6

I have a xib file that support IOS 6 and 7.
The problem is when i selected view as IOS 6 the frame from IOS 7 change, and vice versa.
Here is a screenshot, previewing the IOS 6.1.
I adjust the frame to (0, -3, 255, 85) and when adjust the frame using view as IOS 7 the frame becomes:
(-345,894,0,0).
When i adjust the frame using view as IOS 6.1 and early the frame changes for IOS 7.
I just want to use the same frame in both IOS version.
Some informations that may be relevant:
Was an existing project build for IOS 5.1 and later, then i update the project to support IOS 7.
When i made the update some views (include this one) have their frame changed to positions that does not make any sense and size their size set (0,0).
First i think was an interface builder issue preview issue, but i tested on devices with IOS 6 and 7 and the results are the same from the preview
Thanks in advanced!
When you assign bottom margin & top margin in Autoresizing tab, iOS 7 gets confused & produces strange effects.
I faced the same problem, & i solved it using height stretch. Refer image.
Use 'iOS 6/7 deltas' fields to adjust design element(s) position on your controller for different iOS.
You should setup your project (setup how UI view) for one of iOS versions (6.1 or earlier/7.0 or later) and then adjust interface by deltas to other version.
You also can use new preview mode to see difference between two operation systems on one screen.
Here is link to APPLE iOS 7 transition guide - https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/SupportingEarlieriOS.html#//apple_ref/doc/uid/TP40013174-CH14-SW1
First set your view size as none and then Set your frame using view as iOS 6.1 and earlier. Now test in iOS 6 and 7. It will automatically resize your view frame.

Resources