|
@@ -11,17 +11,23 @@
|
|
|
|
|
|
-(instancetype)initWithDirection:(ZZDirection)direction widgetAlign:(ZZTextImgAlign)widgetAlign{
|
|
|
if (self == [super init]) {
|
|
|
- self.axis = direction;
|
|
|
_lab = [[UILabel alloc] init];
|
|
|
_imgV = [[UIImageView alloc] init];
|
|
|
- [self addArrangedSubview:_imgV];
|
|
|
+
|
|
|
+ _inner = [[UIStackView alloc] init];
|
|
|
+ _inner.axis = direction;
|
|
|
+ [_inner addArrangedSubview:_imgV];
|
|
|
if (widgetAlign == ZZTextImgAlignNormal) {
|
|
|
- [self addArrangedSubview:_lab];
|
|
|
+ [_inner addArrangedSubview:_lab];
|
|
|
}else{
|
|
|
- [self insertArrangedSubview:_lab atIndex:0];
|
|
|
+ [_inner insertArrangedSubview:_lab atIndex:0];
|
|
|
}
|
|
|
+ _inner.distribution = UIStackViewDistributionFill;
|
|
|
+ _inner.alignment = UIStackViewAlignmentCenter;
|
|
|
|
|
|
- self.distribution = UIStackViewDistributionFill;
|
|
|
+ [self addArrangedSubview:_inner];
|
|
|
+ self.axis = direction == ZZDirectionVertical ? ZZDirectionHorizontal : ZZDirectionVertical;
|
|
|
+ self.distribution = UIStackViewDistributionEqualSpacing;
|
|
|
self.alignment = UIStackViewAlignmentCenter;
|
|
|
}
|
|
|
return self;
|