ASButtonNode sets its subnodes as layer backed, but itelf should not be layer backed

This commit is contained in:
Rajinder Ramgarhia
2016-01-20 14:29:34 -05:00
parent 6c56a6046b
commit 389945d69d
2 changed files with 13 additions and 2 deletions

View File

@@ -47,7 +47,7 @@
- (NSAttributedString * _Nullable)attributedTitleForState:(ASControlState)state;
/**
* Sets the styled title to use for the specified state.
* Sets the styled title to use for the specified state. This will reset styled title previously set with -setTitle:withFont:withColor:forState.
*
* @param title The styled text string to use for the title.
* @param state The state that uses the specified title. The possible values are described in ASControlState.
@@ -55,7 +55,7 @@
- (void)setAttributedTitle:(nullable NSAttributedString *)title forState:(ASControlState)state;
/**
* Sets the title to use for the specified state.
* Sets the title to use for the specified state. This will reset styled title previously set with -setAttributedTitle:forState.
*
* @param title The styled text string to use for the title.
* @param font The font to use for the title.

View File

@@ -48,6 +48,11 @@
_titleNode = [[ASTextNode alloc] init];
_imageNode = [[ASImageNode alloc] init];
_backgroundImageNode = [[ASImageNode alloc] init];
[_backgroundImageNode setContentMode:UIViewContentModeScaleToFill];
[_titleNode setLayerBacked:YES];
[_imageNode setLayerBacked:YES];
[_backgroundImageNode setLayerBacked:YES];
_contentHorizontalAlignment = ASAlignmentMiddle;
_contentVerticalAlignment = ASAlignmentCenter;
@@ -59,6 +64,12 @@
return self;
}
- (void)setLayerBacked:(BOOL)layerBacked
{
ASDisplayNodeAssert(!layerBacked, @"ASButtonNode must not be layer backed!");
[super setLayerBacked:layerBacked];
}
- (void)setEnabled:(BOOL)enabled
{
[super setEnabled:enabled];