BarreForestGuide/iOS-app — pull request #19 by agricocb (2014-11-22 06:19:21+00:00)
Title: Unexpected fix/re-write of the POI marker info view bubbles and POI Detail View scene

This pull request is two significant commits. The first is a major rewrite of the POI marker info view bubbles. I initially thought that they would allow links in the bubbles natively, just like the web version of Google Maps, but they don't. Then I created code to work around it with a custom marker info view. I didn't realize until I tried to hook the buttons up to something that when Google gets the custom marker info UIView, it effectively captures a snapshot of them, and displays that, which means that the buttons are just pictures of buttons, and don't actually work. So I had to re-write it even more to duplicate the pop-up bubbles that Google draws, and then place my custom marker info UIView on top. When the user drags the screen, though, the code has to handle moving the UIView around the screen so that it stays on top of the bubble. Also, there are a lot of places where the bubble disappears (when you tap somewhere else on the screen, when you select another marker, when you navigate away from the scene, etc) and all of them have to be patched to remove the UIView from the screen also.

The second commit is the code and the storyboard changes to enable loading the "More info" URL in the embedded UIWebView browser. This is a bit convoluted, since the buttons are generated dynamically, so they can't exist in the storyboard, and so the segues can't be in the storyboard either. So the UIButton gets a callback with a registered target method, which then programmatically pushes the WebKitViewController on to the view controller stack. Since we have to pass a URL to the embedded browser, we have to have a custom WebKitViewController that has an IBOutlet to the UIWebView object in the storyboard, and that controller has a url property, which it loads when the scene starts, and the MapViewController has to set it before pushing it onto the navigation stack.