简体   繁体   中英

iOS 7 Class size compatibility

I've read Apple Documentation about Class sizes and their backward compatibility.

It says, that most classes are compatible with iOS 7 and the main restriction is Compact Height value for iPhone.

Has anyone managed to separate iPhone landscape orientation from portrait? It works great for separating iPads from iPhones, but I didn't get any results for iPhone.

I tried: Portrait: wCompact - hRegular Landscape(default): Any - Any

It always uses Portrait version for both orientations.

Create a class to get CGRect:

.h file

@interface FullScreen : UIScreen
+ (CGRect)iOS7StyleScreenBounds;
@end

.m file

#import "FullScreen.h"

@implementation FullScreen
+ (CGRect)iOS7StyleScreenBounds {
UIScreen *screen = [UIScreen mainScreen]; CGRect screenRect;
if (![screen respondsToSelector:@selector(fixedCoordinateSpace)] && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
    screenRect = CGRectMake(screen.bounds.origin.x, screen.bounds.origin.y, screen.bounds.size.height, screen.bounds.size.width);
} else {
    screenRect = screen.bounds;
}
return screenRect;
}
@end

and call this class like: [FullScreen iOS7StyleScreenBounds]; in your .m file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM