Call javascript functions from xcode
I am currently stuck on how to call javascript functions from xcode.
currently, i have got buttons on my javascript google map... however i want to integrate the google map onto iphone UIWEBVIEW.. an开发者_如何学JAVAd shift all the buttons that are currently on my javascript google map onto a native iphone app toolbar? Any idea how do i start? thankss
I would ask, if you are developing for mobile - you might want to consider using the native maps interface which is MUST faster than loading the traditional Google Maps via the API. If you must you the JavaScript version, then you can have a button on a UIView
on top of the UIWebView
. Pressing the button can result in a call like:
[myUiWebView stringByEvaluatingJavaScriptFromString:@"javascript code I want to execute."];
Your JavaScript code could do things like map.panTo, zoomTo, etc. or any other code to affect the display of the map - of course based on the actual proper GoogleMap calls specific to the version of gmaps you are using.
精彩评论