ASButtonNode content alignement properties

This commit is contained in:
Rajinder Ramgarhia 2015-12-20 21:25:59 -05:00
parent d7492b331f
commit d7b128e19b
3 changed files with 29 additions and 3 deletions

View File

@ -1523,7 +1523,7 @@
058D09B9195D04C000B7D73C /* Frameworks */, 058D09B9195D04C000B7D73C /* Frameworks */,
058D09BA195D04C000B7D73C /* Resources */, 058D09BA195D04C000B7D73C /* Resources */,
3B9D88CDF51B429C8409E4B6 /* Copy Pods Resources */, 3B9D88CDF51B429C8409E4B6 /* Copy Pods Resources */,
1B86F48711505F91D5FEF571 /* Embed Pods Frameworks */, 5ADEA7587189397768F2B36C /* Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
@ -1668,6 +1668,21 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests-resources.sh\"\n"; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests-resources.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
5ADEA7587189397768F2B36C /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AsyncDisplayKitTests/Pods-AsyncDisplayKitTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */

View File

@ -31,6 +31,17 @@ typedef enum : NSUInteger {
*/ */
@property (nonatomic, assign) BOOL laysOutHorizontally; @property (nonatomic, assign) BOOL laysOutHorizontally;
/** Horizontally align content(text or image).
Defaults to ASAlignmentMiddle.
*/
@property (nonatomic, assign) ASHorizontalAlignment contentHorizontalAlignment;
/** Vertically align content(text or image).
Defaults to ASAlignmentCenter.
*/
@property (nonatomic, assign) ASVerticalAlignment contentVerticalAlignment;
- (NSAttributedString *)attributedTitleForState:(ASButtonState)state; - (NSAttributedString *)attributedTitleForState:(ASButtonState)state;
- (void)setAttributedTitle:(NSAttributedString *)title forState:(ASButtonState)state; - (void)setAttributedTitle:(NSAttributedString *)title forState:(ASButtonState)state;

View File

@ -195,8 +195,8 @@
ASStackLayoutSpec *stack = [[ASStackLayoutSpec alloc] init]; ASStackLayoutSpec *stack = [[ASStackLayoutSpec alloc] init];
stack.direction = self.laysOutHorizontally ? ASStackLayoutDirectionHorizontal : ASStackLayoutDirectionVertical; stack.direction = self.laysOutHorizontally ? ASStackLayoutDirectionHorizontal : ASStackLayoutDirectionVertical;
stack.spacing = self.contentSpacing; stack.spacing = self.contentSpacing;
stack.justifyContent = ASStackLayoutJustifyContentCenter; stack.horizontalAlignment = self.contentHorizontalAlignment ? self.contentHorizontalAlignment : ASAlignmentMiddle;
stack.alignItems = ASStackLayoutAlignItemsCenter; stack.verticalAlignment = self.contentVerticalAlignment ? self.contentVerticalAlignment : ASAlignmentCenter;
NSMutableArray *children = [[NSMutableArray alloc] initWithCapacity:2]; NSMutableArray *children = [[NSMutableArray alloc] initWithCapacity:2];
if (self.imageNode.image) { if (self.imageNode.image) {