久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  1. <small id='s6qPJ'></small><noframes id='s6qPJ'>

  2. <legend id='s6qPJ'><style id='s6qPJ'><dir id='s6qPJ'><q id='s6qPJ'></q></dir></style></legend>
    <i id='s6qPJ'><tr id='s6qPJ'><dt id='s6qPJ'><q id='s6qPJ'><span id='s6qPJ'><b id='s6qPJ'><form id='s6qPJ'><ins id='s6qPJ'></ins><ul id='s6qPJ'></ul><sub id='s6qPJ'></sub></form><legend id='s6qPJ'></legend><bdo id='s6qPJ'><pre id='s6qPJ'><center id='s6qPJ'></center></pre></bdo></b><th id='s6qPJ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='s6qPJ'><tfoot id='s6qPJ'></tfoot><dl id='s6qPJ'><fieldset id='s6qPJ'></fieldset></dl></div>

    • <bdo id='s6qPJ'></bdo><ul id='s6qPJ'></ul>
    <tfoot id='s6qPJ'></tfoot>

      IOS:將圖像添加到自定義 MKAnnotationview

      IOS: Adding image to custom MKAnnotationview(IOS:將圖像添加到自定義 MKAnnotationview)

        <i id='tHRnR'><tr id='tHRnR'><dt id='tHRnR'><q id='tHRnR'><span id='tHRnR'><b id='tHRnR'><form id='tHRnR'><ins id='tHRnR'></ins><ul id='tHRnR'></ul><sub id='tHRnR'></sub></form><legend id='tHRnR'></legend><bdo id='tHRnR'><pre id='tHRnR'><center id='tHRnR'></center></pre></bdo></b><th id='tHRnR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='tHRnR'><tfoot id='tHRnR'></tfoot><dl id='tHRnR'><fieldset id='tHRnR'></fieldset></dl></div>
      • <tfoot id='tHRnR'></tfoot>
          <bdo id='tHRnR'></bdo><ul id='tHRnR'></ul>

            <small id='tHRnR'></small><noframes id='tHRnR'>

                <legend id='tHRnR'><style id='tHRnR'><dir id='tHRnR'><q id='tHRnR'></q></dir></style></legend>
                  <tbody id='tHRnR'></tbody>

              • 本文介紹了IOS:將圖像添加到自定義 MKAnnotationview的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我想在地圖中的注釋中添加自定義圖像.我已經(jīng)制作了以下自定義 MapAnnotationView:

                I want to add a custom image to my annotations in the map. And i have made the following custom MapAnnotationView:

                #import <UIKit/UIKit.h>
                #import <Foundation/Foundation.h>
                #import <MapKit/MapKit.h>
                #import <CoreLocation/CoreLocation.h>
                @class POI;
                
                @interface MapAnnotation : MKAnnotationView <MKAnnotation >
                
                @property (nonatomic) CGFloat lat; 
                @property (nonatomic) CGFloat lon;
                @property (nonatomic) CGFloat altitude; 
                @property (nonatomic,  copy) NSString * title;
                @property (nonatomic, copy) NSString * subtitle;
                @property (nonatomic,retain) NSString *source;
                @property (nonatomic,retain) UIImage  *image;
                
                @end
                
                @implementation MapAnnotation
                @synthesize coordinate;
                @synthesize lat=_lat,lon=_lon,altitude= _altitude;
                @synthesize subtitle= _subtitle, title= _title, source=_source, image =_img;
                
                
                - (CLLocationCoordinate2D)coordinate;{
                    CLLocationCoordinate2D position;
                    if (_lat != 0.0 && _lon != 0.0) {
                        position.latitude = _lat;
                        position.longitude = _lon;
                
                    }else {
                        position.latitude=0.0;
                        position.longitude=0.0;
                    }
                
                    return position; 
                }
                
                @end
                
                -(void) mapDataToMapAnnotations{
                
                    NSMutableArray *toRemove = [NSMutableArray arrayWithCapacity:10];
                    for (id annotation in _map.annotations)
                        if (annotation != _map.userLocation)
                            [toRemove addObject:annotation];
                    [_map removeAnnotations:toRemove];
                
                    [_data removeAllObjects];
                
                    [_data addObjectsFromArray:[UDdelegate naturArray]];
                
                
                    if(_data != nil){
                        MapAnnotation * tmpPlace;
                        //for(NSDictionary * poi in _data){
                
                
                        for(POI* poi in _data){
                
                            tmpPlace = [[MapAnnotation alloc]init];
                
                            tmpPlace.title = [poi title];
                            tmpPlace.lat = [poi lat];
                            tmpPlace.lon = [poi lon];
                            tmpPlace.subtitle = [poi dist];
                            tmpPlace.image = [poi poiIcon];
                
                            [self.map addAnnotation:tmpPlace];
                            [_map setNeedsLayout];
                        }
                    }
                }
                

                問題是引腳是標準的 redPin.... 我確定圖標不為空,已經(jīng)檢查過了.

                The problem is that the pins is the standard redPin.... I am sure that the icons isn't null, have checked for that.

                謝謝

                推薦答案

                您必須為 MapKit 委托方法 mapView:viewForAnnotation: 提供自定義視圖.

                You have to serve the MapKit delegate method mapView:viewForAnnotation: with a custom view.

                - (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
                {
                    static NSString *annotationViewReuseIdentifier = @"annotationViewReuseIdentifier";
                
                    MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:annotationViewReuseIdentifier];
                
                    if (annotationView == nil)
                    {
                        annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationViewReuseIdentifier] autorelease];
                    }
                
                    annotationView.image = [UIImage imageNamed:@"pin_image.png"];
                    annotationView.annotation = annotation;
                
                    return annotationView;
                }
                

                要封裝更多內(nèi)容,您應(yīng)該像以前一樣創(chuàng)建一個自定義注釋視圖,并將上面的委托方法與您的類一起提供.

                To encapsulate more you should create a custom annotation view like you did and serve the delegate method above with your class.

                我建議您重命名 MapAnnotation 類,因為它會造成混淆.iOS 中還有注釋,它們是這些注釋視圖的數(shù)據(jù)持有者.為了解決這個問題,我更喜歡編寫繼承類的類型,在這種情況下,MKAnnotationView 在自定義類的末尾.例如 CustomPinAnnotationView.

                I advise you to rename the MapAnnotation class because it is confusing. There are also Annotations in iOS which are the data holders for those annotation views. To solve this I would prefer to write the type of the inherited class, in this case MKAnnotationView at the end of your custom class. For example CustomPinAnnotationView.

                這篇關(guān)于IOS:將圖像添加到自定義 MKAnnotationview的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                Help calculating X and Y from Latitude and Longitude in iPhone(幫助從 iPhone 中的緯度和經(jīng)度計算 X 和 Y)
                Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                CLLocation returning negative speed(CLLocation 返回負速度)
                How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網(wǎng)絡(luò)提供商)

                  <legend id='BRFXF'><style id='BRFXF'><dir id='BRFXF'><q id='BRFXF'></q></dir></style></legend>

                    <tbody id='BRFXF'></tbody>

                  <i id='BRFXF'><tr id='BRFXF'><dt id='BRFXF'><q id='BRFXF'><span id='BRFXF'><b id='BRFXF'><form id='BRFXF'><ins id='BRFXF'></ins><ul id='BRFXF'></ul><sub id='BRFXF'></sub></form><legend id='BRFXF'></legend><bdo id='BRFXF'><pre id='BRFXF'><center id='BRFXF'></center></pre></bdo></b><th id='BRFXF'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BRFXF'><tfoot id='BRFXF'></tfoot><dl id='BRFXF'><fieldset id='BRFXF'></fieldset></dl></div>

                1. <tfoot id='BRFXF'></tfoot>

                  <small id='BRFXF'></small><noframes id='BRFXF'>

                        • <bdo id='BRFXF'></bdo><ul id='BRFXF'></ul>
                          主站蜘蛛池模板: 欧美日韩中文字幕在线 | 久久国产一区二区三区 | 久草新在线| 亚洲高清成人在线 | 91丨九色丨国产在线 | a a毛片 | 精品国产1区2区3区 在线国产视频 | 一区二区三区成人 | 国产欧美日韩精品一区二区三区 | 久草视频在线播放 | 91一区二区 | av网站免费在线观看 | 中文字幕一区二区在线观看 | 一区二区三区四区在线 | 蜜桃在线视频 | 欧美理伦片在线播放 | 一本色道精品久久一区二区三区 | 成人在线观看免费 | 亚洲精品久久久一区二区三区 | 999在线精品 | 中文字幕在线一区二区三区 | 97视频在线观看网站 | 日本久久精品视频 | 九九色综合 | 日日操操 | 日韩欧美在线免费观看 | 久久精品国产亚洲一区二区三区 | 国产99视频精品免费播放照片 | 91精品国产91久久综合桃花 | 在线免费av观看 | 中文日韩字幕 | 日韩精品一区二区三区中文在线 | 中文字幕亚洲精品 | 久久久妇女国产精品影视 | 日韩一区二区av | 久久国产免费 | 亚洲国产成人精品女人久久久 | 蜜臀av日日欢夜夜爽一区 | 亚洲一区二区三区免费在线观看 | 国产精品美女一区二区 | 91视频国产一区 |