mkannotationview

MapKit Annotations not showing up on map

[亡魂溺海] 提交于 2019-12-10 15:17:51
问题 I'm having trouble getting the MKAnnotationViews show up on the map in MapKit. I'm using iOS 7, and have now searched the forums and the web for many hours, trying different samples and setups. Below I have the most basic setup possible (I think) to make it work. The app contains a single ViewController with a toolbar with a button on top, and the rest is the MapView. The button triggers the method zoomToUser:(UIBarButtonItem*)sender. Right-clicking and checking my outlets and delegates seem

How to adjust region to fit custom annotation callout that have just appeared?

混江龙づ霸主 提交于 2019-12-10 09:45:26
问题 I use my custom subclass of MKAnnotationView. In mapView:didSelectAnnotationView: method of my Map's delegate I call the method of this class, which adds UIImageView with an image as a subview - it serves as my custom annotation callout. When using default MKPinAnnotationView map does automatically adjust map region to display the annotation callout that have just appeared. How can I implement this behavior using custom MKAnnotationView subclass? 回答1: Current solution I've crafted demo

iOS MapKit Changing mapview maptype causes annotation image to change to pin?

百般思念 提交于 2019-12-10 02:25:01
问题 Any suggestions on what is wrong with the following would be appreciated. I am adding a custom image to an annotation using the following code. - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { if ([annotation isMemberOfClass:[MKUserLocation class]]) { return nil; } if ([annotation isMemberOfClass:[SpectatorPin class]]) { SpectatorPin *sp = (SpectatorPin *)annotation; MKAnnotationView *view = [self.mapView

Change Pin Color when user tapped

旧城冷巷雨未停 提交于 2019-12-09 06:54:39
问题 I would change the color from red to green of an annotation when the user pin tapped addition to changing its title and subtitle. I am truly lost. I searched how to make a custom annotation pin, ok. I found the implementation of the method when the user touches the pin didSelectAnnotationView and it works when I tap the annotation NSLog(@"Tap") ; , but now I can not change the pin that was touched. Thank you very much everyone for your contributions. Ciao 回答1: To set the pin color, make use

Custom Callout Bubble iOS

前提是你 提交于 2019-12-09 06:52:13
问题 I am developing app with mapview functionality. I want to show custom pin image on mapview, click on that open custom callout bubble with image and title. With click on that callout bubble view I would like to do some functionality. How to achieve this? Any help will be appreciated 回答1: Head over to CocoaControls for custom controls. I bet you'll find something useful for your requirement. Here are some search results from CocoaControls: Callout Bubble Popup Custom Pin Image There are already

Problems with MapView Pin Annotation - Pin loses color when map is zoomed/panned/region changes

杀马特。学长 韩版系。学妹 提交于 2019-12-09 01:31:26
问题 I have a mapview that displays locations of cash points. Annotations are dropped and the callout can be clicked on to go to a page with more detail about that location. There are two categories of cashpoint, free and paid, free cashpoint pins are green and the other red. When the pins drop they are the correct colours. Everything works fine untill i zoom to user location or other areas of the map then when i go back to the pins they have lost their colour formatting and are all the original

NSTimer repeating too fast

不羁的心 提交于 2019-12-08 14:39:42
问题 The Problem I am building an app where I am getting real-time data and updating a MKMapView. I get a batch of data every 10 seconds and between data sets from the webs service I am removing older data points while also adding the new ones. Instead of updating them all at once I want spread out the animation of the new points I get from the data service over that 10 seconds so I create the 'real-time' feel and avoid as many stops and starts as I can. Everything seems to be working great except

Custom curent location Annotation pin not updating with core location

丶灬走出姿态 提交于 2019-12-08 08:41:29
问题 Trying to add a custom pin for current location, However the location does not update. Even after setting setShowsUserLocation = YES; - (id)initWithAnnotation:(id <MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]; if ([[annotation title] isEqualToString:@"Current Location"]) { self.image = [UIImage imageNamed:[NSString stringWithFormat:@"cursor_%i.png", [[Session instance].current_option

MKAnnotationView Subviews

家住魔仙堡 提交于 2019-12-08 04:05:41
问题 Currently, I am having an issue with my project in implementing a custom MKAnnotationView that has multiple custom UIImageViews. So these custom UIImageViews have a clear button on top of them to not have to add gesture recognizers. As you can see, it would be beneficial to actually tap the MKAnnotationView subviews and have some action happen. I implemented a protocol for the MKAnnotationView where each image subview within the MKAnnotationView makes a callback to the controller that is the

Draw MKPointAnnotation with title in MKSnapshot image

空扰寡人 提交于 2019-12-08 01:04:31
问题 I'm trying to draw an annotation exactly as in a 'live' MapView, but then in a MKSnapshot. Why an MKSnapshot > because I want to have non-interactive MapViews in a UITableView and using images is more efficient. I can get a pin to be drawn (though not a point as in iOS 11, the pin looks old) using MKPinAnnotationView, but also then there is no title of the annotation on the image. Using almost exactly this code: Snapshot of MKMapView in iOS7. 回答1: You can use the following steps: with