I am trying to add a new view to a working nav controller app. I edited the DetailViewController.h and DetailViewController.m files for the new view (shown below), created a new DetailViewController.xib file, added the web view. My issue is that I cannot link the file owner to the webview. when i control drag from file owner to the webview, the webview label does not show up, it seems like the xib is not connected to the .h and .m
#import <UIKit/UIKit.h>
@interface DetailViewController : UIViewController {
IBOutlet UIWebView *webView;
}
@property(nonatomic开发者_开发百科,retain) UIWebView *webView;
-(IBAction) goBack:(id)sender;
@end
the top of .m is #import "wwgt3AppDelegate.h" #import "DetailViewController.h" #import "RootViewController.h" @implementation DetailViewController @synthesize webView;
You have to set the class of the file's owner to DetailViewController
, so that Interface Builder knows what outlets are available. You do this in IB, in the Inspector window.
First check the type of the owner in IB. If it's set as DetailViewController, try this syntax for a change:
@interface DetailViewController : UIViewController {
UIWebView *webView;
}
@property (nonatomic,retain) IBOutlet UIWebView *webView;
精彩评论