sebyddd/SDVersion

[SDiPhoneVersion deviceSize] method's compatibility error above IOS8.0

Closed this issue · 3 comments

According to the reference of the property [UIScreen mainScreen].bounds in ios8.0:

Discussion

This rectangle is specified in the current coordinate space, which takes into account any interface rotations in effect for the device. Therefore, the value of this property may change when the device rotates between portrait and landscape orientations.

so the method call [SDiPhoneVersion deviceSize] is error above IOS8.0.In this method , to get the correct value of the screenHeight, code snippet should be added :

//
// After IOS8.0 [UIScreen mainScreen].bounds takes into account any interface rotations in effect for the device,
// so the value of this property will change when the device rotate bewteen portrait and landscape.
//
if(iOSVersionGreaterThanOrEqualTo(@"8.0") && isLandscape){
    screenHeight = [UIScreen mainScreen].bounds.size.width;
}

Added landscape support in 644418a. Thanks for pointing it out 👍

It seems that 644418a is still not work below ios8.0, I has pull a request .

Check 422378f. Thank you!