Search code examples
objective-cioscocoa-touchuiwebviewuiwebviewdelegate

Detecting if a particular view is a webview


I am creating a application which have webviews as well as native screens.I have created nav controller for moving from 1 native screen to another.For moving from 1 webview to another i am using webview's goBack() method.

I want to know how one can detect whether a particular view is a webview or native screen.because then the logic will be written in the nav controller for navigating from native to webview and vice versa.Have tried shouldstartloadwithRequest method of webview delegate and tried finding out Navigationtype also but no luck.

if anybody have done such a thing please suggest the methods to do it.

Thanks


Solution

  • You can check for class membership like this:

    if ([view isKindOfClass:[UIWebView class]]) {
        /* do something */
    }