2013-12-11

Cross import header


WebView.h
@class ViewController; // This pre-declares ViewController, allowing this header to use pointers to ViewController, but not actually use the contents of ViewController

@interface WebView : UIWebView
{
   ViewController* viewController;
}

@end
WebView.m
#import "WebView.h"
#import "ViewController.h" // Gives full access to the ViewController class

@implementation WebView


- (void)doSomething
{
   [viewController doSomethingElse];
}

@end

沒有留言:

張貼留言