This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString * NSStringFromCATransform3D(CATransform3D t) | |
{ | |
return [NSString stringWithFormat:@"CATransform3D {\n% 7.2f % 7.2f % 7.2f % 7.2f\n% 7.2f % 7.2f % 7.2f % 7.2f\n% 7.2f % 7.2f % 7.2f % 7.2f\n% 7.2f % 7.2f % 7.2f % 7.2f\n}", t.m11, t.m12, t.m13, t.m14, t.m21, t.m22, t.m23, t.m24, t.m31, t.m32, t.m33, t.m34, t.m41, t.m42, t.m43, t.m44]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import ImageIO; | |
@implementation UIImage (DHImageDecoding) | |
/// Warning: do not use. This looks like it should work, but it blocks the main thread for non-obvious reasons. | |
+ (UIImage *)dh_decodedImageWithData:(NSData *)data | |
{ | |
CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); | |
if (source == NULL) { | |
return nil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is more hacky than it should be! | |
- (UIModalPresentationStyle)pspdf_currentPresentationStyle { | |
UIViewController *vc = self.presentedViewController.presentingViewController; | |
if ([self respondsToSelector:@selector(adaptivePresentationStyleForTraitCollection:)]) { | |
UIModalPresentationStyle const style = [self adaptivePresentationStyleForTraitCollection:vc.traitCollection]; | |
return (style == UIModalPresentationNone) ? self.presentationStyle : style; | |
} | |
// Before iOS 8.3 we have to fall back on assuming adaptivity is only possible for horizontally compact environments. |