Ever wanted to intercept touches on a view that generally eats them, like MKMapView for instance?
I’d like to allow my user to double-tap the map view to place an annotation marker, rather than the default zoom behaviour. What’s the preferred method of having my program intercept touch events, then either passing them along (single-touch) or not (double-tap)?
Well, here’s a question on Stack Overflow that answers that for MKMapView and probably UIWebView as well: create a wrapper view that intercepts the various touch events, then place the functional view inside it, like this:
#import <MapKit/MapKit.h>
- (void)applicationDidFinishLaunching:(UIApplication *)application {
//We create a view wich will catch Events as they occured and Log them in the Console
viewTouch = [[UIViewTouch alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
//Next we create the MKMapView object, which will be added as a subview of viewTouch
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[viewTouch addSubview:mapView];
//And we display everything!
[window addSubview:viewTouch];
[window makeKeyAndVisible];
}
Colophon:
Second day of The Great WordPress Client Test, and today we’re checking out
ecto 3.0!
Now this acts much more like a Mac program should. Interface is intuitive, category/tag/image composition beats Blogo all hollow, we like that ‘Amazon Helper’ plugin idea, … but there’s some quibbles here too:
- The Preview window is resolutely blank. Blogo, now, it did a nice job of downloading all the appropriate templates from the blog. On the other hand, ecto actually uploaded it as expected and didn’t muck up the categories or lose text and so on … so we don’t count that as a major flaw.
- Doesn’t seem to be a way to blockquote selected text, you have to click into blockquote mode then paste apparently. Not a dealbreaker I suppose, but I do rather like the online editor’s behavior that blockquotes the paragraph containing the insertion point.
- It doesn’t maintain the Undo stack between HTML/text view changes either, even if you don’t actually do anything but switch between the two views.
- Whilst in general the HTML creation and paste handling is excellent, and it’s a brilliant feature to actually force the HTML to be correct before leaving the HTML editor and offer to fix it for you like ecto does … in the particular circumstance where we’d like to paste source code in and slap <pre> tags around it, this feature actually gets in your way as it insists on making every line a new paragraph, which is not what we want as it loses the indentation. Perchance there’s a way around this, but it’s not immediately obvious.
- The initial publish disallowed trackbacks/pingbacks. Presumably that’s a trivial setting fix somewhere, but allowing them really should be the default we think…
So yeah, we like this ecto thing overall, we’ll give it a solid eight from first impressions. Definitely worth an indepth evaluation probably … but we’ll see if we’re completely starstruck by any of the remaining five!
Continue Reading →JUL
