mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-08 05:30:47 +00:00
Set horizontal & vertical alignment default to center. Use ivar to set layout.
This commit is contained in:
parent
d7b128e19b
commit
108ce6d8fc
@ -31,12 +31,12 @@ typedef enum : NSUInteger {
|
|||||||
*/
|
*/
|
||||||
@property (nonatomic, assign) BOOL laysOutHorizontally;
|
@property (nonatomic, assign) BOOL laysOutHorizontally;
|
||||||
|
|
||||||
/** Horizontally align content(text or image).
|
/** Horizontally align content (text or image).
|
||||||
Defaults to ASAlignmentMiddle.
|
Defaults to ASAlignmentMiddle.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign) ASHorizontalAlignment contentHorizontalAlignment;
|
@property (nonatomic, assign) ASHorizontalAlignment contentHorizontalAlignment;
|
||||||
|
|
||||||
/** Vertically align content(text or image).
|
/** Vertically align content (text or image).
|
||||||
Defaults to ASAlignmentCenter.
|
Defaults to ASAlignmentCenter.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign) ASVerticalAlignment contentVerticalAlignment;
|
@property (nonatomic, assign) ASVerticalAlignment contentVerticalAlignment;
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
_titleNode = [[ASTextNode alloc] init];
|
_titleNode = [[ASTextNode alloc] init];
|
||||||
_imageNode = [[ASImageNode alloc] init];
|
_imageNode = [[ASImageNode alloc] init];
|
||||||
|
|
||||||
|
_contentHorizontalAlignment = ASAlignmentMiddle;
|
||||||
|
_contentVerticalAlignment = ASAlignmentCenter;
|
||||||
|
|
||||||
[self addSubnode:_titleNode];
|
[self addSubnode:_titleNode];
|
||||||
[self addSubnode:_imageNode];
|
[self addSubnode:_imageNode];
|
||||||
|
|
||||||
@ -195,8 +198,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.horizontalAlignment = self.contentHorizontalAlignment ? self.contentHorizontalAlignment : ASAlignmentMiddle;
|
stack.horizontalAlignment = _contentHorizontalAlignment;
|
||||||
stack.verticalAlignment = self.contentVerticalAlignment ? self.contentVerticalAlignment : ASAlignmentCenter;
|
stack.verticalAlignment = _contentVerticalAlignment;
|
||||||
|
|
||||||
NSMutableArray *children = [[NSMutableArray alloc] initWithCapacity:2];
|
NSMutableArray *children = [[NSMutableArray alloc] initWithCapacity:2];
|
||||||
if (self.imageNode.image) {
|
if (self.imageNode.image) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user