質問

I've created a subclass of UIView with a bunch of subviews in it (UILabels, UIButtons) which I arrange using autolayout. All is done programmatically. It displays OK and functionallity is ok. however I've recently seen something that worries me.

If I have the size of the iPhone as 3.5" on interface builder and I run the 3.5" simulator, all is OK. If I have the 4" size on the simulator and 4" size on interface builder, all is OK. However, if the size of the simulator and the size of interface builder do not match, my UIView subclass is either too short or too large.

I only have an 3.5" iPhone available, so I cannot test it on device with a 4" screen.

Do I need to worry about that or is it normal behaviour? If I need to worry, how can I fix it? As I commented, I do not set any size on code as everything is done by autolayout with the reference of self.bounds.size.width, for instance.

Any thougths? Thanks in advance!

役に立ちましたか?

解決

They're skewed because you're loading a 3.5" interface on a 4" device and vice versa. As long as the simulator and your device automatically picks up the screen size and load the corresponding layout without you explicitly changing these around, then it will work just fine. You're creating a problem that you don't need to solve.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top