iOS:fix gradiantlayer frame nil

This commit is contained in:
pengfei.zhou 2020-03-23 13:12:32 +08:00 committed by osborn
parent c97bc26de0
commit 7408d9cfed

View File

@ -144,6 +144,7 @@ - (void)blend:(NSDictionary *)props {
[self blendView:self.view forPropName:key propValue:value];
}
[self transformProperties];
self.gradientLayer.frame = CGRectMake(0, 0, self.view.width, self.view.height);
}
- (void)transformProperties {
@ -173,13 +174,11 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
NSNumber *width = (NSNumber *) prop;
if ([width floatValue] >= 0) {
view.width = [width floatValue];
self.gradientLayer.frame = view.bounds;
}
} else if ([name isEqualToString:@"height"]) {
NSNumber *height = (NSNumber *) prop;
if ([height floatValue] >= 0) {
view.height = [height floatValue];
self.gradientLayer.frame = view.bounds;
}
} else if ([name isEqualToString:@"x"]) {
view.x = [prop floatValue];