{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6458","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-native","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6458/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6458/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6458/events","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/6458","id":179239227,"number":6458,"title":"Custom annotation views disappear after scrolling map down and then return back","user":{"login":"aksonov","id":1321329,"avatar_url":"https://avatars.githubusercontent.com/u/1321329?v=3","gravatar_id":"","url":"https://api.github.com/users/aksonov","html_url":"https://github.com/aksonov","followers_url":"https://api.github.com/users/aksonov/followers","following_url":"https://api.github.com/users/aksonov/following{/other_user}","gists_url":"https://api.github.com/users/aksonov/gists{/gist_id}","starred_url":"https://api.github.com/users/aksonov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aksonov/subscriptions","organizations_url":"https://api.github.com/users/aksonov/orgs","repos_url":"https://api.github.com/users/aksonov/repos","events_url":"https://api.github.com/users/aksonov/events{/privacy}","received_events_url":"https://api.github.com/users/aksonov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-26T14:09:34Z","updated_at":"2016-09-27T20:57:43Z","closed_at":"2016-09-26T16:51:35Z","body":"<!--\r\nHello and thanks for contributing! To help us diagnose your problem quickly, please:\r\n\r\n - Include a minimal demonstration of the bug, including code, logs, and screenshots.\r\n - Ensure you can reproduce the bug using the latest release.\r\n - Only post to report a bug or request a feature; direct all other questions to: https://stackoverflow.com/questions/tagged/mapbox\r\n-->\r\n\r\n**Platform:** iOS\r\n**Mapbox SDK version:** latest\r\n\r\n### Steps to trigger behavior\r\n\r\n 1. Create custom annotation class\r\n```\r\n@interface CustomAnnotation : MGLAnnotationView<MGLAnnotation>\r\n\r\n@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;\r\n\r\n@end\r\n\r\n@implementation CustomAnnotation\r\n\r\n-(id)init {\r\n    self = [super init];\r\n    self.frame = CGRectMake(0, 0, 300, 300);\r\n    self.backgroundColor = [UIColor blackColor];\r\n    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];\r\n    label.text = @\"TEST\";\r\n    [self addSubview:label];\r\n    return self;\r\n}\r\n\r\n-(CLLocationCoordinate2D)coordinate {\r\n    CLLocationCoordinate2D coords;\r\n    coords.latitude = 37.33233141;\r\n    coords.longitude = -122.0312186;\r\n    return coords;\r\n}\r\n```\r\n2. Add custom annotation to map:\r\n```\r\n- (nullable MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id <MGLAnnotation>)annotation {\r\n  return annotation;\r\n}\r\n\r\n- (void)viewDidLoad {\r\n  [super viewDidLoad];\r\n  NSURL *styleURL = [NSURL URLWithString:@\"mapbox://styles/mapbox/streets-v8\"];\r\n  \r\n  MGLMapView *mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds styleURL:styleURL];\r\n  \r\n  mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\r\n  mapView.delegate = self;\r\n  \r\n  // Set the map’s center coordinate and zoom level.\r\n  [mapView setCenterCoordinate:CLLocationCoordinate2DMake(37.33233141, -122.0312186)\r\n                     zoomLevel:17\r\n                      animated:NO];\r\n  [mapView addAnnotation:[[CustomAnnotation alloc] init]];\r\n  [self.view addSubview:mapView];\r\n}\r\n```\r\n\r\n3. Run, saw annotation successfully, but it disappears once scroll it away and then scroll back\r\n\r\n### Expected behavior\r\nCustom annotation still visible\r\n\r\n### Actual behaviour\r\nAnnotation disappears\r\n\r\nAm I doing something wrong?"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/comments/249996400","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/6458#issuecomment-249996400","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/6458","id":249996400,"user":{"login":"boundsj","id":63186,"avatar_url":"https://avatars.githubusercontent.com/u/63186?v=3","gravatar_id":"","url":"https://api.github.com/users/boundsj","html_url":"https://github.com/boundsj","followers_url":"https://api.github.com/users/boundsj/followers","following_url":"https://api.github.com/users/boundsj/following{/other_user}","gists_url":"https://api.github.com/users/boundsj/gists{/gist_id}","starred_url":"https://api.github.com/users/boundsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boundsj/subscriptions","organizations_url":"https://api.github.com/users/boundsj/orgs","repos_url":"https://api.github.com/users/boundsj/repos","events_url":"https://api.github.com/users/boundsj/events{/privacy}","received_events_url":"https://api.github.com/users/boundsj/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T20:57:43Z","updated_at":"2016-09-27T20:57:43Z","body":"> dequeueReusableAnnotationViewWithIdentifier call is required for proper work\r\n\r\nThanks agian @aksonov. Although it is a good idea to use the reuse queue and call `dequeueReusableAnnotationViewWithIdentifier:` as shown in the example, I don't think we intended to force developers to use the reuse queue. \r\n\r\nI'm calling this a bug for now and I've proposed a fix in https://github.com/mapbox/mapbox-gl-native/pull/6485. Please follow along there for additional updates."}}
{"actor":{"display_login":"boundsj"}}