This behavior doesn't appear in iOS5.
I am overlaying a view on MKMapView, and when the user touches inside, I want to lock the mapview (setScrollEnabled:NO
) and resize that UIView. I have added a custom gesture recognizer to the map view to check where the touch is, and if it's outside the overlay, the user can move/pinch the map to change the region.
The problem is that with scrollEnabled
set to NO, even though it always reports the appropriate value when I check it with NSLog
, the map view scrolls anyway.
Code
MyViewController.m
// viewcontroller that contains the map view; this is the delegate as well
@implementation MyViewController
{
//private vars
MKMapView *_mapView;
}
//...
- (void)configTheMap
{
_mapView = //initwithframe
//add it as subview, bring it to front
[_mapView setDelegate:self]
//setup gesture recognizer
[gesture setTouchesBeganBlock:^(NSSet *touches, UIEvent *event) {
//if touch is in the circle set _mapView scrollEnabled:NO
}];
//touchesMoved, touchesEnded
[_mapView addGestureRecognizer:gesture];
}
As I said, in iOS 5, this works as expected, the map view region is locked as I'm touching inside my defined points. In iOS 6, it does so unreliably. Sometimes the region stays locked, sometimes it seems to break free. I can exit the view and return to it, and I can not predict how it will act. I added an NSLog in touchesMoved to check the status of the _mapView
's scrollEnabled
and it returns NO
as expected.
Can anyone help?