Maybe have an NSNotification
fire when an NSString
instance field is changed. Use the post here to help understand how to communicate between JavaScript and Objective-C.
Then, it is just a matter of notification and string logic:
Steps for JavaScript to Objective-C:
- Web view button is pressed.
- JavaScript fires method which returns string.
- Local NSString is updated to denote button in Web view was pressed (see post above).
- NSNotification fires based on string change.
- Objective-C closes the Web view.
Not sure what you want to pass back to the Web view from Objective-C, but the above post should help.