Comments (6)
OK, so this was pretty tricky but I think I figured it out. On iOS 6, MKMapView
uses a UIGestureRecognizer
to figure out when you've tapped on the map. For some reason, when you attempt to click a UITextField
in the callout, this causes the gesture recognizer to fire and the map view to think that you've clicked outside the pin and wish to dismiss the callout.
I've just pushed an example to the master branch that demonstrates how to work around this. The trick is to subclass MKMapView
and override the gesture recognizer delegate to swallow touches from UIControl
subclasses. Just uncomment the three lines that create a UITextField
to see it in action.
Hope this works for you!
from calloutview.
Still no luck, could the problem be caused by AutoLayout and/or using much larger view than standard callout created from a nib which also uses auto layout? As well I also have a long press attached to the map.
I noticed that I in that overridden delegate method for gesture recogniser, the touch.view is always MKAnnotationContainerView
I did some printing in the debugger.
why does the callout view have negative x/y?
from calloutview.
Ok, so main the difference between how your sample code works and what happens when I tap the map in code, is precisely, what is under touch.view. In your case it is indeed what I clicked, button/textfield/etc. In my code its ALWAYS that MKAnnotationContainerView no matter what I click. The weird part, I am pretty much not doing anything else than whats in the sample project.
from calloutview.
Hm, that's weird. So how did you fix it?
from calloutview.
Turns out that altering -pointInside:(CGPoint)point withEvent:(UIEvent *)event inside SMCalloutView by adding
contentViews pointsInside method to be also checked, does the job perfectly. I am not sure if I removed this line before by myself. But it works now.
from calloutview.
Yeah, I should have explicitly mentioned that, but that was one of the things I fixed when looking into this originally. Glad that did the trick!
from calloutview.
Related Issues (20)
- The current deployment target does not support automated __weak references HOT 2
- Xcode Warning when clear custom view set by another pin HOT 1
- Add support for tvOS MapKit 😊 added in 9.2 HOT 2
- animationDidStop delegate callback checks for finished HOT 3
- Crashing on CLLayer position contains NaN HOT 7
- Swift 3 support? HOT 1
- How to change the background HOT 1
- Content View Touch - weird behaviour HOT 2
- Crashing when annotation is selected programmatically in viewDidLoad
- Is it possible to increase the view height and allow a multiline subtitle? HOT 16
- Is it possible to add a touch event to the calloutview?
- convert to swift HOT 7
- Contentview with constraints fails HOT 1
- Using SMCalloutView wit Mapbox HOT 3
- Performance issues HOT 2
- Crash when tap near the screen edges HOT 3
- Increase Callout Popup delay HOT 5
- calloutView with AutoLayout
- Not issue but Question : Calloutview with Mapbox HOT 6
- Refresh callout view in calloutViewClicked HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from calloutview.