Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-11-2011, 11:33 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 3
iHAL is on a distinguished road
Default Trigger Javascript Function on Web Page with Button on Toolbar

Greetings,

I am in the process of creating a very simple native app for the iPad with Xcode 4. It consists of a UIWebView and a Toolbar with a few Buttons. When the app is launched, it loads a webpage that I have designed. The design scheme is that all the "work" is done by the web page.

Here is what I want to know how to do:
When a Toolbar Button is pressed - I want it to trigger a Javascript function on my webpage. This would be analogous to the HTML <...onclick:"GenericJavascriptFunctionName()".../>, only I want the same GenericJavacriptFunctionName() to be triggered when I press a Toolbar Button on my native app.

Thanks in advance
iHAL is offline   Reply With Quote
Old 03-11-2011, 02:16 PM   #2 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 3
iHAL is on a distinguished road
Default

In case this can be useful to others, what I needed was "stringByEvaluatingJavaScriptFromString".

This leads me to another problem due to my being a n00b - how do I execute my stringByEvaluatingJavaScriptFromString when my toolbar button is pressed?
iHAL is offline   Reply With Quote
Old 03-11-2011, 04:45 PM   #3 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 3
iHAL is on a distinguished road
Default

Actually that is a piece of cake! If another n00b happens to stumble upon this check out YouTube - iPhone SDK: Creating Buttons and Adding Actions & Alert View it shows you what you need to know!
iHAL is offline   Reply With Quote
Reply

Bookmarks

Tags
button, html, javascript, toolbar, uiwebview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 367
8 members and 359 guests
Absentia, akphyo, apatsufas, BinHex, fredidf, Kirkout, MarkC, mottdog
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:24 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0