Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iOS Google maps中使用AFnetworking图像缓存刷新标记信息窗口?_Ios_Google Maps_Afnetworking 2 - Fatal编程技术网

如何在iOS Google maps中使用AFnetworking图像缓存刷新标记信息窗口?

如何在iOS Google maps中使用AFnetworking图像缓存刷新标记信息窗口?,ios,google-maps,afnetworking-2,Ios,Google Maps,Afnetworking 2,根据谷歌的文档,信息窗口是在我得到图像之前呈现的 Note: The info window is rendered as an image each time it is displayed on the map. This means that any changes to its properties while it is active will not be immediately visible. The contents of the info window will

根据谷歌的文档,信息窗口是在我得到图像之前呈现的

Note: The info window is rendered as an image each time it is displayed on the map. 
This means that any changes to its properties while it is active will not be immediately visible.     
The contents of the info window will be refreshed the next time that it is displayed.
是否有人正在使用AFNetworking的图像缓存并成功更新infowindow视图,而不会污染标记的片段? 我已经搜索过了,但找不到任何解决方案。我在标记的代码段中有地址和一些其他信息,所以不能将其用作标志

顺便说一句,我跟随谷歌从xib创建信息窗口

参考文献:


我解决了以下问题

我使用此属性作为信息窗口

@property (nonatomic) MyInfoWindow* infoWindow 
这就是我如何编写GMSMapViewDelegate的委托方法

- (UIView*)mapView:(GMSMapView*)mapView markerInfoWindow:(GMSMarker*)marker
{
    //Prepare Data
    MyEvent* selectedEvent = [EventManager eventForEventID:marker.objectID];
    //Prepare Thumbnail URL
    NSURLRequest* request = [[NSURLRequest alloc] initWithURL:[selectedEvent getSmallBannerWithSize:@"w50"]];

    //Prepare InfoView's UIView
    _infoWindow = [[[NSBundle mainBundle] loadNibNamed:@"infoWindowView" owner:self options:nil] objectAtIndex:0];
    _infoWindow.title.text = selectedEvent.eventName;

    //Get cached image from AFNetworking
    UIImage* img = [[UIImageView sharedImageCache] cachedImageForRequest:request];
    if (img == nil) {
        [_infoWindow.thumbnail setImageWithURLRequest:request 
                               placeholderImage:[UIImage imageNamed:@"placeholder"] 
          success:^(NSURLRequest* request, NSHTTPURLResponse* response, UIImage* image) {
            //Invoke selection to call this delegate method again
            [mapView setSelectedMarker:marker]; 
        } failure:^(NSURLRequest* request, NSHTTPURLResponse* response, NSError* error) {
            NSLog(@"RY fetching thumbnail image error : %@", request);
        }];
    } else {
        // If we can get the cached image, which means the image is downloaded, 
        // then update the info window
        _infoWindow.thumbnail.image = img;
    }
    return _infoWindow;
}

我通过设置以下内容解决了类似的问题:

marker.tracksInfoWindowChanges = true
在mapView markerInfoWindow中,然后在图像加载后(即在“成功:”完成处理程序中,我设置图像,然后设置:

marker.tracksInfoWindowChanges = false
还有