iOS run snake
This commit is contained in:
@@ -28,7 +28,7 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
|
||||
NSInteger i;
|
||||
for (i = 0; i< array.count; i++) {
|
||||
NSDictionary *val = array[i];
|
||||
if (!val) {
|
||||
if (!val || (NSNull *)val == [NSNull null]) {
|
||||
continue;
|
||||
}
|
||||
NSString *type = [val objectForKey:@"type"];
|
||||
|
@@ -11,8 +11,18 @@
|
||||
#import "DoricRootNode.h"
|
||||
#import "DoricConstant.h"
|
||||
|
||||
@interface DoricViewNode()
|
||||
@property (nonatomic,strong) NSMutableDictionary *callbackIds;
|
||||
@end
|
||||
|
||||
@implementation DoricViewNode
|
||||
|
||||
- (instancetype)initWithContext:(DoricContext *)doricContext {
|
||||
if(self = [super initWithContext:doricContext]) {
|
||||
_callbackIds = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (UIView *)build:(NSDictionary *)props {
|
||||
return [[UIView alloc] init];
|
||||
}
|
||||
@@ -54,11 +64,20 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
|
||||
if(self.parent && [prop isKindOfClass:[NSDictionary class]]){
|
||||
[self.parent blendChild:self layoutConfig:prop];
|
||||
}
|
||||
} else {
|
||||
} else if([name isEqualToString:@"onClick"]) {
|
||||
[self.callbackIds setObject:prop forKey:@"onClick"];
|
||||
view.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer *tapGesturRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onClick:)];
|
||||
[view addGestureRecognizer:tapGesturRecognizer];
|
||||
}else {
|
||||
DoricLog(@"Blend View error for View Type :%@, prop is %@", self.class, name);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onClick:(UIView *)view {
|
||||
[self callJSResponse:[self.callbackIds objectForKey:@"onClick"],nil];
|
||||
}
|
||||
|
||||
- (CGFloat)measuredWidth {
|
||||
if ([self.layoutParams isKindOfClass: MarginLayoutParams.class]) {
|
||||
MarginLayoutParams *marginParams = (MarginLayoutParams *)self.layoutParams;
|
||||
@@ -91,7 +110,7 @@ - (void)layoutByParent:(DoricGroupNode *)parent {
|
||||
node = node.parent;
|
||||
} while (node && ![node isKindOfClass:[DoricRootNode class]]);
|
||||
|
||||
return ret;
|
||||
return [[ret reverseObjectEnumerator] allObjects];
|
||||
}
|
||||
|
||||
- (void)callJSResponse:(NSString *)funcId,... {
|
||||
|
Reference in New Issue
Block a user