Merge pull request #103 from aleclarson/facebook

Add ASDisplayNode.cornerRadius
This commit is contained in:
Nadine Salter
2014-11-14 13:19:13 -08:00
4 changed files with 30 additions and 0 deletions

View File

@@ -461,6 +461,7 @@
@property (atomic, assign) CGPoint anchorPoint; // default={0.5, 0.5}
@property (atomic, assign) CGFloat zPosition; // default=0.0
@property (atomic, assign) CGPoint position; // default=CGPointZero
@property (atomic, assign) CGFloat cornerRadius; // default=0.0
@property (atomic, assign) CGFloat contentsScale; // default=1.0f. See @contentsScaleForDisplay for more info
@property (atomic, assign) CATransform3D transform; // default=CATransform3DIdentity
@property (atomic, assign) CATransform3D subnodeTransform; // default=CATransform3DIdentity

View File

@@ -18,6 +18,7 @@
@property (nonatomic, assign) CGFloat zPosition;
@property (nonatomic, assign) CGPoint anchorPoint;
@property (nonatomic, retain) id contents;
@property (nonatomic, assign) CGFloat cornerRadius;
@property (nonatomic, assign) CGFloat contentsScale;
@property (nonatomic, assign) CATransform3D transform;
@property (nonatomic, assign) CATransform3D sublayerTransform;

View File

@@ -78,6 +78,18 @@
_setToViewOrLayer(opacity, newAlpha, alpha, newAlpha);
}
- (CGFloat)cornerRadius
{
_bridge_prologue;
return _getFromLayer(cornerRadius);
}
-(void)setCornerRadius:(CGFloat)newCornerRadius
{
_bridge_prologue;
_setToLayer(cornerRadius, newCornerRadius);
}
- (CGFloat)contentsScale
{
_bridge_prologue;

View File

@@ -22,6 +22,7 @@
CGColorRef backgroundColor;
id contents;
CGFloat alpha;
CGFloat cornerRadius;
UIViewContentMode contentMode;
CGPoint anchorPoint;
CGPoint position;
@@ -65,6 +66,7 @@
int setContents:1;
int setHidden:1;
int setAlpha:1;
int setCornerRadius:1;
int setContentMode:1;
int setNeedsDisplay:1;
int setAnchorPoint:1;
@@ -112,6 +114,7 @@
@synthesize autoresizingMask=autoresizingMask;
@synthesize tintColor=tintColor;
@synthesize alpha=alpha;
@synthesize cornerRadius=cornerRadius;
@synthesize contentMode=contentMode;
@synthesize anchorPoint=anchorPoint;
@synthesize position=position;
@@ -156,6 +159,7 @@
needsDisplayOnBoundsChange = NO;
autoresizesSubviews = YES;
alpha = 1.0f;
cornerRadius = 0.0f;
contentMode = UIViewContentModeScaleToFill;
_flags.needsDisplay = NO;
anchorPoint = CGPointMake(0.5, 0.5);
@@ -296,6 +300,12 @@
_flags.setAlpha = YES;
}
- (void)setCornerRadius:(CGFloat)newCornerRadius
{
cornerRadius = newCornerRadius;
_flags.setCornerRadius = YES;
}
- (void)setContentMode:(UIViewContentMode)newContentMode
{
contentMode = newContentMode;
@@ -573,6 +583,9 @@
if (_flags.setAlpha)
layer.opacity = alpha;
if (_flags.setCornerRadius)
layer.cornerRadius = cornerRadius;
if (_flags.setContentMode)
layer.contentsGravity = ASDisplayNodeCAContentsGravityFromUIContentMode(contentMode);
@@ -673,6 +686,9 @@
if (_flags.setAlpha)
view.alpha = alpha;
if (_flags.setCornerRadius)
layer.cornerRadius = cornerRadius;
if (_flags.setContentMode)
view.contentMode = contentMode;