Use ASDisplayNodeScreenScale().

ASImageNode and ASHighlightOverlayLayer were both using
[[UIScreen mainScreen] scale] directly.  Bad.  No cookie.  Use
ASDisplayNodeScreenScale() instead.

(Also, regenerate Xcode project with Xcode 6 and current CocoaPods.)
This commit is contained in:
Nadine Salter 2014-10-21 16:49:19 -07:00
parent d01fb5f418
commit 367b6da116
6 changed files with 903 additions and 3492 deletions

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@ BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector)
return (superclassIMP != subclassIMP); return (superclassIMP != subclassIMP);
} }
static CGFloat ASDisplayNodeScreenScale() CGFloat ASDisplayNodeScreenScale()
{ {
static CGFloat screenScale = 0.0; static CGFloat screenScale = 0.0;
static dispatch_once_t onceToken; static dispatch_once_t onceToken;

View File

@ -8,10 +8,11 @@
#import "ASImageNode.h" #import "ASImageNode.h"
#import <AsyncDisplayKit/_ASDisplayLayer.h>
#import <AsyncDisplayKit/_ASCoreAnimationExtras.h> #import <AsyncDisplayKit/_ASCoreAnimationExtras.h>
#import <AsyncDisplayKit/_ASDisplayLayer.h>
#import <AsyncDisplayKit/ASAssert.h> #import <AsyncDisplayKit/ASAssert.h>
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h> #import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
#import "ASImageNode+CGExtras.h" #import "ASImageNode+CGExtras.h"
@ -83,7 +84,7 @@
return nil; return nil;
// TODO can this be removed? // TODO can this be removed?
self.contentsScale = [[UIScreen mainScreen] scale]; self.contentsScale = ASDisplayNodeScreenScale();
self.contentMode = UIViewContentModeScaleAspectFill; self.contentMode = UIViewContentModeScaleAspectFill;
self.opaque = YES; self.opaque = YES;

View File

@ -10,6 +10,8 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
static const CGFloat kCornerRadius = 2.5; static const CGFloat kCornerRadius = 2.5;
static const UIEdgeInsets padding = {2, 4, 1.5, 4}; static const UIEdgeInsets padding = {2, 4, 1.5, 4};
@ -21,7 +23,7 @@ static const UIEdgeInsets padding = {2, 4, 1.5, 4};
+ (id)defaultValueForKey:(NSString *)key + (id)defaultValueForKey:(NSString *)key
{ {
if ([key isEqualToString:@"contentsScale"]) { if ([key isEqualToString:@"contentsScale"]) {
return [NSNumber numberWithFloat:[[UIScreen mainScreen] scale]]; return @(ASDisplayNodeScreenScale());
} else if ([key isEqualToString:@"highlightColor"]) { } else if ([key isEqualToString:@"highlightColor"]) {
CGFloat components[] = {0, 0, 0, 0.25}; CGFloat components[] = {0, 0, 0, 0.25};
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

View File

@ -19,6 +19,7 @@
#import "ASThread.h" #import "ASThread.h"
BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector); BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector);
CGFloat ASDisplayNodeScreenScale();
@class _ASPendingState; @class _ASPendingState;

View File

@ -7,4 +7,4 @@ DEPENDENCIES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
OCMock: 6db79185520e24f9f299548f2b8b07e41d881bd5 OCMock: 6db79185520e24f9f299548f2b8b07e41d881bd5
COCOAPODS: 0.34.2 COCOAPODS: 0.34.4