• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UIWebView IBOutlet is always nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: UIWebView IBOutlet is always nil
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Re: What am I looking for in the documentation?
  • Next by Date: how to run NSApplicationMain() in child process?
  • Previous by thread: Writing a custom Spotlight Importer
  • Next by thread: Re: UIWebView IBOutlet is always nil
  • Index(es):
    • Date
    • Thread