mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-26 12:55:56 +08:00
Support UIViewContentModeCenter with ASImageNode
This commit is contained in:
@@ -181,7 +181,8 @@
|
|||||||
|| alphaInfo == kCGImageAlphaPremultipliedLast;
|
|| alphaInfo == kCGImageAlphaPremultipliedLast;
|
||||||
|
|
||||||
BOOL contentModeSupported = contentMode == UIViewContentModeScaleAspectFill
|
BOOL contentModeSupported = contentMode == UIViewContentModeScaleAspectFill
|
||||||
|| contentMode == UIViewContentModeScaleAspectFit;
|
|| contentMode == UIViewContentModeScaleAspectFit
|
||||||
|
|| contentMode == UIViewContentModeCenter;
|
||||||
|
|
||||||
CGSize backingSize;
|
CGSize backingSize;
|
||||||
CGRect imageDrawRect;
|
CGRect imageDrawRect;
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ static void __ASDisplayLayerDecrementConcurrentDisplayCount(BOOL displayIsAsync,
|
|||||||
if (stretchable) {
|
if (stretchable) {
|
||||||
ASDisplayNodeSetupLayerContentsWithResizableImage(_layer, image);
|
ASDisplayNodeSetupLayerContentsWithResizableImage(_layer, image);
|
||||||
} else {
|
} else {
|
||||||
_layer.contentsScale = image.scale;
|
_layer.contentsScale = self.contentsScale;
|
||||||
_layer.contents = (id)image.CGImage;
|
_layer.contents = (id)image.CGImage;
|
||||||
}
|
}
|
||||||
[self didDisplayAsyncLayer:self.asyncLayer];
|
[self didDisplayAsyncLayer:self.asyncLayer];
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ static const CGFloat kInnerPadding = 10.0f;
|
|||||||
_imageNode.URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://placekitten.com/%zd/%zd",
|
_imageNode.URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://placekitten.com/%zd/%zd",
|
||||||
(NSInteger)roundl(_kittenSize.width),
|
(NSInteger)roundl(_kittenSize.width),
|
||||||
(NSInteger)roundl(_kittenSize.height)]];
|
(NSInteger)roundl(_kittenSize.height)]];
|
||||||
|
// _imageNode.contentMode = UIViewContentModeCenter;
|
||||||
[self addSubnode:_imageNode];
|
[self addSubnode:_imageNode];
|
||||||
|
|
||||||
// lorem ipsum text, plus some nice styling
|
// lorem ipsum text, plus some nice styling
|
||||||
|
|||||||
Reference in New Issue
Block a user