Search code examples
iphoneios5three20

Strange layout issue on 3GS device with iOS 4.2.1 - Compiled with iOS 5


We had a strange bug report from a user who has iOS 4.2.1 on an iPhone 3GS. A lot of the UITextLabels in the app are offset at strange locations. Has anyone else come across this issue.

The app is laid out correctly on all devices we have tested on and we have only heard of this issue from 2 users out of over 100,000.

This could be related to Three20 styles.

misaligned text

enter image description here


Solution

  • We hit exactly the same issue with our layouts. We are not using Three20 though. There is a known issue when building with iOS 5.0 and running on iOS 4.2.1 that causes CGRects to be initialised incorrectly once you are using optimised code. (ie compiled with the fastest,smallest optimization level) so you won't see it when testing on a debug version which usually has this set to None.

    There is a workaround to fix it. You simply need to add a compiler flag for:

    "OTHER_CFLAGS[arch=armv6]" = "-mno-thumb";

    (You can add this either directly into the project file or from the build settings tab of the project).

    Please see an apple forum thread explaining the complete issue:

    https://devforums.apple.com/thread/122059?tstart=15