Search code examples
iosuitableviewautoresize

UiTableViewCell autoresize for different Device


I'm trying to optimize my app for iPhone 6 and iPhone 6 + but I have a problem with the cells in the tableview.

i'm using Xcode 6 and iOS 8 .

In a few words as you can see from the image:

iPhone 4s on my tableview should scroll to view all of the cells iPhone 5 and 5s I have no problem iPhone 6 and iPhone 6 + much room left after the last cell ...

I need to align the cells in my tableview for all devices in praticolar way for iPhone 6 and iPhone 6 + .. I'm not using the autolayout therefore use the autoresize in the size of the storyboard inspector but does not seem to work ... can someone 'help me understand with some examples, how can I solve this problem ??

enter image description here


Solution

  • i'm solved with :

    #define iPhone4sEnable ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )480 ) < DBL_EPSILON )
    #define iPhone5Enable ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
    #define iPhone6Enable ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )667 ) < DBL_EPSILON )
    #define iPhone6PlusEnable ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )736 ) < DBL_EPSILON )