I created a new project as an iOS Single View app in Xcode. I created a custom class called WebView that extends the UIWebView interface. In the storyboard, I add a WebView to the ViewController and then create an IBOutlet for the WebView in ViewController.h. Instead of using the UIWebView class for IBOutlet, I use my Cusom WebView class and import its header file into ViewController.h. Now my ViewController is connected to the Web VIew class of the WebView.
Then I want my WebView to have a link to a UIViewController. Then I import ViewController.h into my WebView.h, but then I run some compiler errors, for example:
Unknown type name 'WebView'; did you mean "UIWebView"?
I think the problem is that ViewController.h imports WebView.h and WebView.h imports ViewController.h. Can't cross-import in Objective-C?
source
share