My requirement is: I need to initialize a specific objective-c class and call its method from javscript using UIWebview like below eg:
I have an objective-c class called "Calculator" which has the following methods
@interface Calculator : NSObject {
}
@property (nonatomic, retain) start;
@property (nonatomic, retain) add:(NSInteger) a with:(NSInteger) b;
@property (nonatomic, retain) subract:(NSInteger) a by:(NSInteger) b;;
@end;
I have a UIWebview, in which I am loading HTML with JS. Here, I have a JS script function like
function callNativeClass() {
window.calc.start;
}
"calc" is the instance or namespace of the class. I need to call the start method from JS.
Can you please tell me, is there any option to call native objective-c class like PhoneGap?