mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-04 13:38:21 +00:00
Fix landscape screenshot issues in iOS 8
This commit is contained in:
parent
bc475061f2
commit
b9f149b33e
@ -742,7 +742,10 @@ UIImage *bit_screenshot(void) {
|
|||||||
BOOL isLandscapeRight = [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight;
|
BOOL isLandscapeRight = [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight;
|
||||||
BOOL isUpsideDown = [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown;
|
BOOL isUpsideDown = [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown;
|
||||||
|
|
||||||
if (isLandscapeLeft ||isLandscapeRight) {
|
BOOL needsRotation = NO;
|
||||||
|
|
||||||
|
if ((isLandscapeLeft ||isLandscapeRight) && imageSize.height > imageSize.width) {
|
||||||
|
needsRotation = YES;
|
||||||
CGFloat temp = imageSize.width;
|
CGFloat temp = imageSize.width;
|
||||||
imageSize.width = imageSize.height;
|
imageSize.width = imageSize.height;
|
||||||
imageSize.height = temp;
|
imageSize.height = temp;
|
||||||
@ -771,10 +774,12 @@ UIImage *bit_screenshot(void) {
|
|||||||
-[window bounds].size.width * [[window layer] anchorPoint].x,
|
-[window bounds].size.width * [[window layer] anchorPoint].x,
|
||||||
-[window bounds].size.height * [[window layer] anchorPoint].y);
|
-[window bounds].size.height * [[window layer] anchorPoint].y);
|
||||||
|
|
||||||
if (isLandscapeLeft) {
|
if (needsRotation) {
|
||||||
CGContextConcatCTM(context, CGAffineTransformRotate(CGAffineTransformMakeTranslation( imageSize.width, 0), M_PI / 2.0));
|
if (isLandscapeLeft) {
|
||||||
} else if (isLandscapeRight) {
|
CGContextConcatCTM(context, CGAffineTransformRotate(CGAffineTransformMakeTranslation( imageSize.width, 0), M_PI / 2.0));
|
||||||
CGContextConcatCTM(context, CGAffineTransformRotate(CGAffineTransformMakeTranslation( 0, imageSize.height), 3 * M_PI / 2.0));
|
} else if (isLandscapeRight) {
|
||||||
|
CGContextConcatCTM(context, CGAffineTransformRotate(CGAffineTransformMakeTranslation( 0, imageSize.height), 3 * M_PI / 2.0));
|
||||||
|
}
|
||||||
} else if (isUpsideDown) {
|
} else if (isUpsideDown) {
|
||||||
CGContextConcatCTM(context, CGAffineTransformRotate(CGAffineTransformMakeTranslation( imageSize.width, imageSize.height), M_PI));
|
CGContextConcatCTM(context, CGAffineTransformRotate(CGAffineTransformMakeTranslation( imageSize.width, imageSize.height), M_PI));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,7 +153,7 @@ typedef NS_ENUM(NSInteger, BITImageAnnotationViewControllerInteractionMode) {
|
|||||||
- (void)fitImageViewFrame {
|
- (void)fitImageViewFrame {
|
||||||
|
|
||||||
CGSize size = [UIScreen mainScreen].bounds.size;
|
CGSize size = [UIScreen mainScreen].bounds.size;
|
||||||
if (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)){
|
if (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation) && size.height > size.width){
|
||||||
size = CGSizeMake(size.height, size.width);
|
size = CGSizeMake(size.height, size.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user