danielamitay / DAKeyboardControl

DAKeyboardControl adds keyboard awareness and scrolling dismissal (ala iMessages app) to any view with only 1 line of code.
Other
1.58k stars 214 forks source link

Adding the control causes MKMapView/UIScrollView inside a UIScrollView to scroll the parent scrollview. #11

Closed ChrisGrant closed 12 years ago

ChrisGrant commented 12 years ago

See this question on stack overflow:

http://stackoverflow.com/questions/12450539/mkmapview-panning-causes-parent-uiscrollview-to-scroll/

When you add a MKMapView (or UIScrollView) to a parent UIScrollView, the control hits the method:

even if it the control isn't being used.

To replicate this, add a control to a simple one view window. Then add the following code to the viewDidLoad:

UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; [scrollView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth]; // Make the content size large to allow scroll view to move [scrollView setContentSize:CGSizeMake(1000, 2000)]; [self.view addSubview:scrollView];

double mapHeight = 200;

MKMapView *map = [[MKMapView alloc] initWithFrame:CGRectMake(0, 200, self.view.bounds.size.width, mapHeight)]; [scrollView addSubview:map];

This causes the bug to be reproduced. Contact me and I can send you a sample project which reproduces it.

danielamitay commented 12 years ago

If you already have a sample project, would definitely appreciate it: {email redacted}

I'll take a look as soon as I can.

ChrisGrant commented 12 years ago

Thank you - I've mailed the sample project to you now. Let me know if you don't get it.

danielamitay commented 12 years ago

Apologies for the delay. Basically, as a UIView category, DAKeyboardControl was intercepting some UIGestureRecognizer delegate methods from other views, even when you hadn't activated DAKeyboardControl on them.

Added a sanity check to prevent this interception. Thanks for pointing it out!

ChrisGrant commented 12 years ago

Thanks for the fix! Appreciate it.