Skip to content

Commit

Permalink
Include screen height in iPad screenshots since we have multiple iPad…
Browse files Browse the repository at this point in the history
… device sizes now.
  • Loading branch information
ksuther committed Nov 3, 2015
1 parent d093e91 commit c0427a1
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions KSScreenshotManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,19 @@ - (void)saveScreenshot:(NSString *)name includeStatusBar:(BOOL)includeStatusBar
UIImage *image = [UIImage imageWithCGImage:CGImage];
NSString *devicePrefix;
NSString *screenDensity = isRetina ? [NSString stringWithFormat:@"@%.0fx", [[UIScreen mainScreen] scale]] : @"";

CGFloat screenHeight;

if ([[UIScreen mainScreen] respondsToSelector:@selector(coordinateSpace)]) {
// Always refer to screens by the vertical height, even if the screenshot is landscape
screenHeight = CGRectGetHeight([[[UIScreen mainScreen] coordinateSpace] convertRect:[[UIScreen mainScreen] bounds] toCoordinateSpace:[[UIScreen mainScreen] fixedCoordinateSpace]]);
} else {
screenHeight = CGRectGetHeight([[UIScreen mainScreen] bounds]);
}

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
CGFloat screenHeight;

if ([[UIScreen mainScreen] respondsToSelector:@selector(coordinateSpace)]) {
// Always refer to screens by the vertical height, even if the screenshot is landscape
screenHeight = CGRectGetHeight([[[UIScreen mainScreen] coordinateSpace] convertRect:[[UIScreen mainScreen] bounds] toCoordinateSpace:[[UIScreen mainScreen] fixedCoordinateSpace]]);
} else {
screenHeight = CGRectGetHeight([[UIScreen mainScreen] bounds]);
}

devicePrefix = [NSString stringWithFormat:@"iphone%.0f%@", screenHeight, screenDensity];
} else {
devicePrefix = [NSString stringWithFormat:@"ipad%@",screenDensity];
devicePrefix = [NSString stringWithFormat:@"ipad%.0f%@", screenHeight, screenDensity];
}

NSData *data = UIImagePNGRepresentation(image);
Expand Down

0 comments on commit c0427a1

Please sign in to comment.