Skip to content

Commit

Permalink
Merge pull request #8 from gzucm/pull1.0.0
Browse files Browse the repository at this point in the history
deviceSize method consider landscape orientation status
  • Loading branch information
sebyddd committed Oct 16, 2014
2 parents b90fa03 + da6f882 commit bb10061
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion SDiPhoneVersion/SDiPhoneVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ +(DeviceVersion)deviceVersion {

+(DeviceSize)deviceSize {

CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
CGFloat screenHeight = ({
// consider landscape orientation status
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
BOOL isLandscape = (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight);
CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width;
screenHeight = isLandscape ? screenWidth : screenHeight;
});
if (screenHeight == 480)
return iPhone35inch;
else if(screenHeight == 568)
Expand Down

0 comments on commit bb10061

Please sign in to comment.