Note that there are some explanatory texts on larger screens.

plurals
  1. POUIWebView BringToFront
    primarykey
    data
    text
    <p>I've been banging my head against the wall for awhile on this but here it goes. I'm using PhoneGap to build an app. There's a tab bar at the bottom with 5 tabs and one tab loads a Google Map (MapKit from an old plugin from GitHub) but the problem is that when you switch to a different tab right after being in the map tab, the new tab does not accept touch events as if the map was still there. (The map is not visible, here's how:</p> <pre><code>self.mapView.hidden = YES; self.childView.hidden = YES; </code></pre> <p>But if you do this: Map Tab -> Home Tab -> Notification Tab then touch events work on the Notification tab.</p> <p>I think the way to fix this is to somehow bring the UIWebview that PhoneGap uses to the front.</p> <p>I've tried:</p> <pre><code>[self.childView bringSubviewToFront:self.webView]; </code></pre> <p>and:</p> <pre><code>[self.webView bringSubviewToFront:self.mapView]; </code></pre> <p>and also:</p> <pre><code>[self.viewController bringSubviewToFront:self.webView] </code></pre> <p>The last line of code gives this error: 'UIViewController' may not respond to 'bringSubviewToFront:' and nothing happens.</p> <p>Here is the code that is used to draw the Map:</p> <pre><code>if (!self.mapView) { [self createView]; } // defaults CGFloat height = 480.0f; CGFloat offsetTop = 0.0f; if ([options objectForKey:@"height"]) { height=[[options objectForKey:@"height"] floatValue]; } if ([options objectForKey:@"offsetTop"]) { offsetTop=[[options objectForKey:@"offsetTop"] floatValue]; } if ([options objectForKey:@"buttonCallback"]) { self.buttonCallback=[[options objectForKey:@"buttonCallback"] description]; } if ([options objectForKey:@"regionDidChangeCallback"]) { self.regionDidChangeCallback=[[options objectForKey:@"regionDidChangeCallback"] description]; } CLLocationCoordinate2D centerCoord = { [[options objectForKey:@"lat"] floatValue] , [[options objectForKey:@"lon"] floatValue] }; CLLocationDistance diameter = [[options objectForKey:@"diameter"] floatValue]; CGRect webViewBounds = self.webView.bounds; CGRect mapBounds; mapBounds = CGRectMake( webViewBounds.origin.x, webViewBounds.origin.y + (offsetTop / 2), webViewBounds.size.width, webViewBounds.origin.y + height ); [self.childView setFrame:mapBounds]; [self.mapView setFrame:mapBounds]; MKCoordinateRegion region=[ self.mapView regionThatFits: MKCoordinateRegionMakeWithDistance(centerCoord, diameter*(height / webViewBounds.size.width), diameter*(height / webViewBounds.size.width))]; [self.mapView setRegion:region animated:YES]; </code></pre> <p>Any help would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload