This seems like a strange one. Not even sure if it is possible!!
I have a UIWebView that loads a local html page. On this html page I have a button.
I want to click on the button and then call an IBAction in Xcode.
How would I go about this? Or can you even do this???
Thanks guys,
Stefan.
You can do it by using a custom protocol. In you html file, you can link to something like
myProtocol://callSomeAction.Then on your
UIWebViewDelegate(probably yourUIViewController) you have to implement the method called:(Docs here)
The idea is that on that code, you detect the protocol based on the data in the
requestparameter. If it ismyProtocol, you can call yourIBActionand returnNO. If it’s something else, you fallback to have the web view load the page, and just returnYES.The code would look something like this: