mapkit

multiple regionDidChangeAnimated calls - what gives?

泪湿孤枕 提交于 2019-12-13 20:10:49
问题 I have a MKMapView inside a UITableView as a custom cell (don't ask ;) - don't know if it matters really), for which I register a regionDidChangeAnimated delegate method. This method gets called three times when the UITableView is loaded - once with the actual region and then two more times with a region that is way off. In the simulator, I consistently get a region with center (+37.43997405, -97.03125000). On the device, it seems to depend on the location reported by the location manager,

Cannot call viewForAnnotation function in MapKit

泪湿孤枕 提交于 2019-12-13 19:14:12
问题 I have already checked many questions in StackOverflow but none of them worked for me. I am developing an iPad application. I created all interfaces in Storyboard. For my project I created one view controller and corresponding .h .m files and linked them. Then I added MKMapView inside of the view controller then I referenced mapView in view controller file by using Interface Builder. I created bunch of points and showed them on map. Everything was perfect until I decided to change pin colors.

Creating a dynamic MKAnnotationView in Swift

只愿长相守 提交于 2019-12-13 19:01:52
问题 Currently, I know how to create a MKAnnotationView with a static pin, an image that's added. Does anyone know, or have any resources, on how to create a pin that would change colors or have a number displayed inside of it that would change depending on information about the business? For instance, I would like to have a pin be red when the business is closed, and green when the business is open. Maybe even a dollar signs inside of the pin to tell the user how expensive it is. EDIT I have

Creating Custom Call out View

拟墨画扇 提交于 2019-12-13 18:31:03
问题 I'm trying to add a view when I click in a pin, but appears only the title and subtitle and not the view that I did add. Here is my code -(void) inserirMapa { AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate]; NSMutableArray *pins = [[NSMutableArray alloc]init]; //array de Annotations for(int iCnt = 0; iCnt < [_listaPins count]; iCnt++) { Pin *pin = (Pin *) [_listaPins objectAtIndex:iCnt]; CLLocationCoordinate2D start; start.latitude = pin.place.latitude;

Ignore mapView:didSelectAnnotationView when long press is occuring

蓝咒 提交于 2019-12-13 13:49:54
问题 I am struggling with this one. I have a mapview with many pins in a small area. I want to ignore the mapview's selecting of an annotation when I am long pressing on the map, regardless if i am longpressing on an annotation view. It seems as though the annotation is getting selected on a touchDown, rather than touch up inside on the annotation view, which is annoying. I have added a longpress gesture to the mapview: UILongPressGestureRecognizer *longRec = [[UILongPressGestureRecognizer alloc]

Change the image's origin of map annotation view?

谁都会走 提交于 2019-12-13 12:01:55
问题 The regular annotation pin's origin is in the middle of the bottom so, the pin always point to the same place. But when I add my custom image, its origin is the center of the image, so every zoom in or out, the bottom of my image point to a different place. Here my pin is supposed to point to the center of paris BUT but when I zoom in, the bottom of my pin isn't pointing to the center of Paris. I'm trying with the CGRect.origin but didn't get anything useful. Here is my code: -

Calculate angle between three GPS coordinates

依然范特西╮ 提交于 2019-12-13 10:54:07
问题 perhaps this is a simple question. I have 3 GPS coordinates (one is the current user location). What I want now is to calculate the angle between the user location and the two GPS coordinates. Imagine the user location in the center of the two other points, the three points can be seen as a triangle. And I want to calculate the angle at the user location. I hope someone can help me because I have no idea how to do this with spherical coordinates like the GPS coordinates I have. THX - nekro

How to send a location from my app to other apps in swift?

心已入冬 提交于 2019-12-13 09:48:39
问题 I have a location in my app. I want to make a button that sends this location to other apps like google maps or waze. How can I do that? 回答1: Create a ActionSheet like you have added in image. And for all the applications in the list like GoogleMaps,Maps,Waze do the following on click.. BOOL canHandle = [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps:"]]; if (canHandle) { UIApplication.shared.openURL(URL(string: "comgooglemaps://?center=\(self.location

How to add Action selector to the popup bubble on Annotation view [duplicate]

霸气de小男生 提交于 2019-12-13 08:06:54
问题 This question already has an answer here : CalloutAccessoryView view for MKPinAnnotationView (1 answer) Closed 6 years ago . I have very new to MapKit Implementation In my app one page is to be map View in that I have displayed bulk amount of pins and their Annotation actions. I have added a Discloser button on the popup bubble and set action for these discloser buttons as shown bellow. i Want to Same action When tap on that gray bubble //To add a discloser button to show route map UIButton

Swift Filter same location coordinates contained inside an array of objects

旧巷老猫 提交于 2019-12-13 07:32:06
问题 I am receiving from Server, a list of Stores information in an array of objects. Below is a sample - "stores": [ { "name": “Store 1”, "number": "5381", "country": "BELGIE", "latLng": [ 50.730614, 4.231847 ] }, { "name": "Store 2”, "number": "5220", "country": "BELGIE", "latLng": [ 50.730614, 4.231847 ] }, { "name": "Store 3”, "number": "3982”, "country": "BELGIE", "latLng": [ 50.7315706, 4.2303477 ] }, { "name": "Store 4”, "number": "4179", "country": "BELGIE", "latLng": [ 50.7262577, 4