File tree 1 file changed +12
-1
lines changed
iphone/TitaniumKit/TitaniumKit/Sources/Kroll
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -652,6 +652,9 @@ - (id)_valueForKey:(NSString *)key
652
652
return [[[KrollMethod alloc ] initWithTarget: target selector: @selector (toString: ) argcount: 0 type: KrollMethodInvoke name: nil context: [self context ]] autorelease ];
653
653
}
654
654
655
+ // For something like TiUiTextWidgetProxy focused:(id)unused - this will assume it's a function/method
656
+ // So to work around this, we need to explicitly declare a property named "focused" with a different underlying getter
657
+ // to expose it as a property to JS
655
658
SEL selector = NSSelectorFromString ([NSString stringWithFormat: @" %@ :" , key]);
656
659
if ([target respondsToSelector: selector]) {
657
660
return [[[KrollMethod alloc ] initWithTarget: target
@@ -688,7 +691,15 @@ - (id)_valueForKey:(NSString *)key
688
691
}
689
692
} else {
690
693
NSString *attributes = [NSString stringWithCString: property_getAttributes (p) encoding: NSUTF8StringEncoding];
691
- SEL selector = NSSelectorFromString ([NSString stringWithCString: property_getName (p) encoding: NSUTF8StringEncoding]);
694
+ // look up getter name from the property attributes
695
+ SEL selector;
696
+ const char *getterName = property_copyAttributeValue (p, " G" );
697
+ if (getterName != nil ) {
698
+ selector = sel_getUid (getterName);
699
+ } else {
700
+ // not set, so use the property name
701
+ selector = NSSelectorFromString ([NSString stringWithCString: property_getName (p) encoding: NSUTF8StringEncoding]);
702
+ }
692
703
693
704
if ([attributes hasPrefix: @" T@" ]) {
694
705
// this means its a return type of id
You can’t perform that action at this time.
0 commit comments