Re: viewWillDisappear not being called
Re: viewWillDisappear not being called
- Subject: Re: viewWillDisappear not being called
- From: Evadne Wu <email@hidden>
- Date: Tue, 26 Apr 2011 14:01:59 +0800
It seems like you need to do something when the app resigns from the foreground — if that is the case just listen for UIApplicationDidEnterBackgroundNotification from that view controller? It (kind of) makes things easy that way.
As the app enters background, it surely has “disappeared” but no, the particular view has not disappeared. It is the entire app that has “disappeared”.
Hope that helps. :)
-ev
On Apr 26, 2011, at 13:19, Jeffrey Walton wrote:
> On Mon, Apr 25, 2011 at 11:04 PM, Heath Borders <email@hidden> wrote:
>> I've seen this behavior also, specifically on iOS 3.1 while using a
>> UIViewController inside a UINavigationController inside a
>> UITabBarController.
> YES - that is nearly my setup (iOS 4.3.2). I don't have the
> intermediate UINavigationController, but the view has an
> UINavigationBar.
>
> Any ideas on how to locate an arbitrary view controller? The following
> only locates the 5 associated with the Tab Bar, and not the top most
> PasswordPromptController (which was presented modally).
>
> It sure would have been helpful if viewWillDisappear was sent as
> documented. When the home button is pressed, and the home screen is
> presented, the view has clearly disappeared (no offense Alex).
>
> Jeff
>
> - (void)applicationWillResignActive:(UIApplication *)application
> {
> if(tabBarController.viewControllers != nil)
> [self clearPasswords:tabBarController.viewControllers];
> }
>
> - (void)clearPasswords:(NSArray *)viewsControllers
> {
> Class passwordPromptClass = [PasswordPromptController class];
>
> for (UIViewController * viewController in viewsControllers)
> {
> if ([viewController isKindOfClass:passwordPromptClass])
> [(PasswordPromptController *)viewController clearPassworAndPin];
> }
> }
>
>>
>> On Mon, Apr 25, 2011 at 9:59 PM, Jeffrey Walton <email@hidden> wrote:
>>> Hi All,
>>>
>>> According to the documentation in the headers:
>>>
>>> // UIViewController.h
>>> // Called when the view is dismissed, covered or otherwise hidden.
>>> - (void)viewWillDisappear:(BOOL)animated;
>>>
>>> And Apple's documentation [1]:
>>>
>>> Notifies the view controller that its view is about to be dismissed,
>>> covered, or otherwise hidden from view.
>>>
>>> I'm not sure if I should be surprised or not, but viewWillDisappear
>>> does not appear to be called despite what the documentation claims.
>>>
>>> The view is part of a custom view controller (built with IB - nothing
>>> fancy) and presented modally. To duplicate, show a view modally and
>>> press the home button.
>>>
>>> Thanks in advance,
>>> Jeff
>>>
>>> [1] http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html
>>> [SNIP]
> _______________________________________________
>
> 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
_______________________________________________
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