add image default blur
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
@interface DoricImageNode ()
|
||||
@property(nonatomic, copy) NSString *loadCallbackId;
|
||||
@property(nonatomic, assign) BOOL isBlur;
|
||||
@end
|
||||
|
||||
@implementation DoricImageNode
|
||||
@@ -36,6 +37,15 @@ - (UIImageView *)build {
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)blend:(NSDictionary *)props {
|
||||
NSInteger value = [props[@"isBlur"] intValue];
|
||||
if(value == 1) {
|
||||
self.isBlur = YES;
|
||||
}
|
||||
|
||||
[super blend:props];
|
||||
}
|
||||
|
||||
- (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id)prop {
|
||||
if ([@"imageUrl" isEqualToString:name]) {
|
||||
__weak typeof(self) _self = self;
|
||||
@@ -53,6 +63,13 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
|
||||
}
|
||||
[self requestLayout];
|
||||
}
|
||||
|
||||
if(self.isBlur) {
|
||||
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
|
||||
UIVisualEffectView *effectView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];
|
||||
effectView.frame = CGRectMake(0, 0, image.size.width, image.size.height);
|
||||
[view addSubview:effectView];
|
||||
}
|
||||
}];
|
||||
} else if ([@"scaleType" isEqualToString:name]) {
|
||||
switch ([prop integerValue]) {
|
||||
|
Reference in New Issue
Block a user