Search code examples
objective-ciosxcode4.2itunesios5

Images of UITableView Cells change?


While i finished developing an in-app-purchase application, and after several testing on iPad/Iphone, every thing was fine, the images of table view's cells and its hight was exactly as wrote in code, so i upload the application, when it was processed to the app Store, i download it, the table view cells in both IPhone/IPad were in different sizes much bigger size then that was set while testing,so the image in cells was like stretched!!!!and not clear, i tried to test it then directly via xcode to my device, it was almost fine as before, but the problem is only when downloading from store,

I really appreciate any help, testing image

after downloading from store

Regards,


Solution

  • This is quite likely to be do with floating-point calculation optimization.

    When building for release, by default, Xcode will try to fully optimize your code, including making your floating-point calculations more efficient. However, sometimes they can be incorrectly optimized, and this can cause major issues especially with positioning / sizing of views etc.

    For me, this happens when building for release + armv6 architecture, and I've had exactly the same problem (only realized when released) before.

    Thankfully, there is a way to disable the floating-point optimizations. Here's how:

    Using LLVM GCC 4.2

    1. Click on your project in the files pane on the left
    2. Click the project name under Targets (as seen below), then click "Build Settings".
    3. Search for "thumb" in the search box on the right hand side
    4. You should see a setting called "Compile for Thumb" under "LLVM GCC 4.2 - Code Generation". If you don't, it's because you're using the Apple LLVM compiler 3.0 (instructions for that are below).
    5. Hover over Release, and click the plus icon.
    6. A new option should appear, with a drop-down, select "ARMv6" from the dropdown.
    7. Then select "No" for that option. It should now look like below:

    Screenshot showing Compile for Thumb setting


    Using Apple LLVM 3.0 Compiler

    1. Follow steps 1 and 2 above.
    2. Search for "other c flags" in the search box
    3. Follow the same steps above to add a specific configuration for ARMv6 + release.
    4. Double-click the box with the flags in, and add the flag -mno-thumb. It should now look like below

    Disabling Compiile for Thumb for the Apple Compiler

    If it still has issues under the release build after that, you may want to try disabling compile for thumb globally.

    Hope that helps.