iphone के किसी अन्य स्थान के साथ वर्तमान स्थान दिखा रहा है, साथ

वोट
2

जब भी हम एक MapView लोड करते हैं, यह automaticallay वर्तमान उपयोगकर्ता स्थान सही पता चलता है। मेरे मामले में मैं नक्शे पर किसी अन्य स्थान दिखा रहा हूँ, ऐसा है कि नक्शा वर्तमान स्थान लोड करता है और स्थान मैं दे दिया है करने के लिए जूम .. लेकिन, वर्तमान स्थान बिंदु (नीले एक जो automaticay आता है ..) नहीं दिख रहा था। मैं mapView.showCurrentLocation दे दिया है = true; लेकिन इसकी नहीं दिखा रहा। इतना कर सकता है किसी भी एक तरीका बताता है यह काम करता है और यह वर्तमान स्थान निशान कहना चाहिए और उसके बाद बिंदु मैं दे दिया है करने के लिए जूम। धन्यवाद

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
    static NSString *defaultPinID = @CameraAnnotation;
    MKPinAnnotationView *retval = nil;
    static int postag=1;

    (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
    if(annotation=MapView.userLocation)
    {
        return nil;
    }
    // If we have to, create a new view
    else    if (retval == nil)
    {
        retval = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];

        UIButton *myDetailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        myDetailButton.frame = CGRectMake(0, 0, 50, 23);
        myDetailButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        myDetailButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        myDetailButton.tag=postag;
        postag++;
        [myDetailButton addTarget:self action:@selector(showLinks:) forControlEvents:UIControlEventTouchUpInside];
        retval.rightCalloutAccessoryView = myDetailButton;
        [retval setPinColor:MKPinAnnotationColorRed];
        retval.animatesDrop = YES;
        retval.canShowCallout = YES;
    }

    return retval;
}
07/05/2010 को 09:54
का स्रोत उपयोगकर्ता
अन्य भाषाओं में...                            


2 जवाब

वोट
2

सिम्युलेटर में डिफ़ॉल्ट वर्तमान स्थान Cupertino.This आप क्या देख रहे हैं, यह डिवाइस में ठीक से काम करेंगे है।

अधिक से अधिक आप CLLocationManager का उपयोग करना चाहिए वर्तमान स्थान प्राप्त करने के लिए।

- (void)applicationDidFinishLaunching:(UIApplication *)application { 
{
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self; // Tells the location manager to send updates to this object
[locationManager startUpdatingLocation];
}

पिन रंग बदलने के लिए

MKPinAnnotationView   *pin=[[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"pin"]autorelease];

[pin setPinColor:MKPinAnnotationColorRed];

शुभकामनाएं।

07/05/2010 को 10:03
का स्रोत उपयोगकर्ता

वोट
1

पर एक नज़र डालें जवाब इस सवाल पर सभी MKAnnotations इसे से जुड़े समाहित करने के लिए MKMapView ज़ूम स्तर सेट करने के लिए

07/05/2010 को 12:38
का स्रोत उपयोगकर्ता

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