UIWebView IBOutlet is always nil
UIWebView IBOutlet is always nil
- Subject: UIWebView IBOutlet is always nil
- From: Michael Crawford <email@hidden>
- Date: Sun, 05 May 2013 16:47:32 -0700
I have a UINavigationController-based app that I would like to use a
UIWebView to show an HTML page. My problem is that I declare my UIWebView
property as an IBOutlet, and it is always nil.
This is apparently a very common problem. Google turns up lots of queries
at StackOverflow. I read them all, but no joy.
I tried deleting my build folder, and my built app, but that didn't help.
My XIB file has a UIView with the UIWebView on top of it. Is that
correct? Or am I supposed to use a UIWindow?
The file's owner has the IBOutlet that references the UIWebView. I've
tried connecting the file's owner "view" IBOutlet both to the file-scoped
view, and to the UIWebView.
The file's owner is declared as a ManualViewControllerIOS in the Identity
inspected.
// ManualViewControllerIOS.h
#import <UIKit/UIKit.h>
@interface ManualViewControllerIOS : UIViewController {
}
@property (retain,nonatomic) IBOutlet UIWebView *webView;
@end
// ManualViewControllerIOS.m
#import "ManualViewControllerIOS.h"
@implementation ManualViewControllerIOS
@synthesize webView;
- (void) viewDidAppear: (BOOL) animated
{
[super viewDidAppear: animated];
NSString *manualIndex;
NSBundle *mainBundle = [NSBundle mainBundle];
manualIndex = [mainBundle pathForResource:
@"index" ofType: @"html"];
NSLog( @"%@", webView );
[webView loadRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString: manualIndex]]];
}
@end
Here is how I push my view controller onto the UINavigationController stack:
- (IBAction) manual: (id) sender
{
ManualViewControllerIOS *manualViewController =
[[[ManualViewControllerIOS alloc] init] autorelease];
[self.navigationController pushViewController: manualViewController
animated: YES];
return;
}
My App is quite complex, so I'm writing an online manual. At first I was
loading it from my website, but that doesn't satisfy when the Internet is
out of reach. UIWebView would be the cat's meow if I could get it to work.
Thanks for any help you can give me,
Mike
--
Michael David Crawford
mdcrawford at gmail dot com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden