If you’re creating the web view in -viewDidLoad, you should probably release
it and nil the pointer to it in -viewDidUnload, not -dealloc.

Jeff Kelley


On Sat, Jun 18, 2011 at 12:19 PM, Matt Neuburg <[email protected]> wrote:

> >"Important: Before releasing an instance of UIWebView for which you
> >have set a delegate, you must first set the UIWebView delegate
> >property to nil before disposing of the UIWebView instance. This can
> >be done, for example, in the dealloc method where you dispose of the
> >UIWebView."
> >
> >The delegate for the UIWebView is set up in the XIB file; it's pretty
> >hokey to have to intervene in code to then disassociate the view from
> >its delegate.  Also, there is no "dealloc method where you dispose of
> >the UIWebView", because that's done automatically when the view is
> >popped off the navigation stack.
>
> What I do is start with a UIViewController subclass that creates the
> UIWebView in viewDidLoad and disposes of it in dealloc, setting the delegate
> to nil first, just as suggested in the docs. It's not clear to me why
> creating the UIWebView in the nib would make any difference. m.
>
> --
> matt neuburg, phd = [email protected], <http://www.apeth.net/matt/>
> A fool + a tool + an autorelease pool = cool!
> Programming iOS 4!
>
> http://www.apeth.net/matt/default.html#iosbook_______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/slaunchaman%40gmail.com
>
> This email sent to [email protected]
>
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to