views:

65

answers:

1

I have a viewController that pops a modal view with a UIWebView. If I visit a particularly heavy page, I start getting memory warnings, followed by the parent view getting unloaded. This is all fine and dandy, but when I close the modal view, my parent reloads (as expected) but is not longer able to process any touch events. The app responds to orientation changes correctly, but no amount of touching changes anything. Buttons don't work, a UIWebView doesn't respond to scrolling (but loads a default website), etc. It's as if there is a transparent UIView overlaying my entire window. Any ideas why this may occur?

Here's how I show the modal window:

BrowsingViewController* controller = [[BrowsingViewController alloc] 
    initWithNibName:UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ?     
    @"BrowsingViewController-iPad" : @"BrowsingViewController" 
      bundle:nil initialURL:[[request URL] absoluteString]];    
[self presentModalViewController:controller animated:YES];      
[controller release];

Here's how I dismiss it (from the modal view itself):

- (void) onCloseTouch
{   
    [self.parentViewController dismissModalViewControllerAnimated:YES]; 
}

EDIT:

Going through the view hierarchy, I don't notice anything out of the norm. Here are my log statements for the main view controller. They are identical both before and after I show my modal view:

viewWillAppear called.
=============== parentViewController subviews count=2
View [0] is a UINavigationTransitionView
subview count=0
View [1] is a UINavigationBar
subview count=2
      subview [0] is a UINavigationItemView
      subview [1] is a UINavigationButton
=============== self views subviews count=3
View [0] is a UIWebView with tag [1]
subview count=1
      subview [0] is a UIScrollView with tag [0]
View [1] is a UIToolbar with tag [2]
subview count=3
      subview [0] is a UIToolbarTextButton with tag [0]
      subview [1] is a UIToolbarButton with tag [0]
      subview [2] is a UIToolbarButton with tag [0]
View [2] is a UIView with tag [3]
subview count=2
      subview [0] is a UIActivityIndicatorView with tag [31]
      subview [1] is a UILabel with tag [32]

EDIT #2: This issue does not appear to occur on iPhone, just iPad. I have examined all places where I am performing a if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) and none of this logic appears to be of any consequence.

+1  A: 

I wouldn't dismiss in that manner; I would use the delegate pattern instead: when BrowsingViewController wants to close, it calls something like [delegate browsingViewControllerDidFinish:self];. This is the "usual" way to dismiss the view controller, and it also eliminates the requirement that BrowsingViewController always be presented modally by its parent view controller.

What are the differences between the BrowsingViewController and BrowsingViewController-iPad xibs?

I would do some checking in the "parent" view controller, stepping through its view and all subviews to see if there's anything overlaid (as you say) atop the entire view hierarchy that is blocking the touch events.

Shaggy Frog
The differences between the xibs are negligible. In fact, I tested it using the iPhone specific version on the iPad and am still able to reproduce the problem. The question has been updated on examining the view hierarchy.
Wayne Hartman
Found the problem. It traces back to how I was dismissing the modal view. My viewDidAppear method was checking the modal view and if it was present, having it display another 'stacked' modal. The problem was, this was getting called after the previous one had been dismissed. Why this wasn't manifesting itself on the iPhone is beyond me, but shame on me for bad programming!
Wayne Hartman