बजाय एक iPhone की MapKit ढांचे में डिफ़ॉल्ट पिन की छवि?

वोट
6

यह हमारी अपनी बजाय छवि iPhone पर MapKit मानचित्र में डिफ़ॉल्ट पिन के लिए संभव है?

मैं एक आवेदन जो बहुत जैसे Google अक्षांश मित्रों के स्थान दिखाने के लिए और उनके स्थानों पर मित्र की छवि दिखाने के लिए की आवश्यकता होगी पर काम कर रहा हूँ।

यह संभव है जावास्क्रिप्ट गूगल मानचित्र का उपयोग, लेकिन मैं पता करने के लिए अगर किसी को MapKit आधार पर नक्शे के लिए कुछ नमूना कोड दे सकते हैं चाहता हूँ।

29/09/2009 को 15:15
का स्रोत उपयोगकर्ता
अन्य भाषाओं में...                            


3 जवाब

वोट
14

हाँ यह संभव है। उस के लिए यू MKAnnotationView बजाय MKPinAnnotationView उपयोग करना होगा। और annotation.animatesDrop संपत्ति का उपयोग नहीं करते।

यहाँ, आप viewForAnnotation में उपयोग कर सकते हैं नमूना कोड हैं

    annotation = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"try"];
    annotation.canShowCallout = YES;

    annotation.image = [UIImage imageNamed:@"image.png"];


    return annotation;
29/09/2009 को 15:20
का स्रोत उपयोगकर्ता

वोट
2

तुम भी छवि के फ्रेम सेट कर सकते हैं। कि उपरोक्त कोड में के लिए हम इस सरल परिवर्तन करने की आवश्यकता।

UIImage *pinImage = [UIImage imageNamed:@"image.png"];

UIImageView *imageView = [[[UIImageView alloc] initWithImage:pinImage] autorelease];

       imageView.frame = CGRectMake(-20, 0, 40, 30);

[annotation addSubview:imageView];

और हम लाइन टिप्पणी करने के लिए है

// annotation.image = [UIImage imageNamed:@"image.png"];
29/11/2010 को 07:38
का स्रोत उपयोगकर्ता

वोट
0

अवधि संपत्ति का उपयोग कर आप आसानी से ज़ूम कर सकते हैं करने के लिए अपने की आवश्यकता होती है

MKCoordinateSpan अवधि;

MKCoordinateRegion region;


mapView.scrollEnabled=YES;
span.latitudeDelta = 100.0;//more value you set your zoom level will increase
span.longitudeDelta =100.0;//more value you set your zoom level will increase
mapView.showsUserLocation=YES;
region.span = span;


region.center = from.coordinate;
  [mapView setRegion:region animated:YES];
 [mapView regionThatFits:region];
[mapView addAnnotation:from];
25/07/2013 को 08:39
का स्रोत उपयोगकर्ता

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more