Layout add minWidth minHeight maxWidth maxHeight
This commit is contained in:
@@ -104,6 +104,15 @@ - (void)measure:(CGSize)targetSize {
|
||||
width - self.paddingLeft - self.paddingRight,
|
||||
height - self.paddingTop - self.paddingBottom)];
|
||||
|
||||
if ([self restrainSize]) {
|
||||
[self measureContent:CGSizeMake(
|
||||
self.measuredWidth - self.paddingLeft - self.paddingRight,
|
||||
self.measuredHeight - self.paddingTop - self.paddingBottom)];
|
||||
}
|
||||
[self restrainSize];
|
||||
}
|
||||
|
||||
- (BOOL)restrainSize {
|
||||
BOOL needRemeasure = NO;
|
||||
if (self.measuredWidth > self.maxWidth) {
|
||||
self.measuredWidth = self.maxWidth;
|
||||
@@ -121,11 +130,7 @@ - (void)measure:(CGSize)targetSize {
|
||||
self.measuredHeight = self.minHeight;
|
||||
needRemeasure = YES;
|
||||
}
|
||||
if (needRemeasure) {
|
||||
[self measureContent:CGSizeMake(
|
||||
self.measuredWidth - self.paddingLeft - self.paddingRight,
|
||||
self.measuredHeight - self.paddingTop - self.paddingBottom)];
|
||||
}
|
||||
return needRemeasure;
|
||||
}
|
||||
|
||||
- (void)measureContent:(CGSize)targetSize {
|
||||
|
@@ -430,6 +430,18 @@ - (void)blendLayoutConfig:(NSDictionary *)params {
|
||||
[params[@"weight"] also:^(NSNumber *it) {
|
||||
self.view.doricLayout.weight = (DoricGravity) [it integerValue];
|
||||
}];
|
||||
[params[@"maxWidth"] also:^(NSNumber *it) {
|
||||
self.view.doricLayout.maxWidth = (DoricGravity) [it integerValue];
|
||||
}];
|
||||
[params[@"maxHeight"] also:^(NSNumber *it) {
|
||||
self.view.doricLayout.maxHeight = (DoricGravity) [it integerValue];
|
||||
}];
|
||||
[params[@"minWidth"] also:^(NSNumber *it) {
|
||||
self.view.doricLayout.minWidth = (DoricGravity) [it integerValue];
|
||||
}];
|
||||
[params[@"minHeight"] also:^(NSNumber *it) {
|
||||
self.view.doricLayout.minHeight = (DoricGravity) [it integerValue];
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSDictionary *)transformation {
|
||||
|
Reference in New Issue
Block a user