iphone - I am not able to give an MKAnnotation an image! -


O People! Instead of seeing a pin, I have a problem seeing an image rather than seeing an MK annotation. In other words, I'm having trouble displaying the target image instead of the normal pin view. Here I have my code ---

  // .h file #import / / Here it asks to import MapKit and UIKit. Code Blokcot that I do not show // "Import you @ interface address annotation: Ansobij {CLLocationCoordinate2D coordination; NSString * mTitle; NSString * mSubTitle;} @ end @ Intfetr decided Sthansthan: UIViewController {IBOutlet MKMapView * mapView; Adding address add address * ;} - (CLLocationCoordinate2D) address space; //. M file @ Implementation address annotation @ Synthesize coordination; - (NSString *) subtitles {NSUserDefaults * prefs = [NSUserDefaults standard user default]; NSString * stitle = [prefs objectForKey: @ " AddressKey "]; Return @"% @ ", Style;} - Title (NSString *) Title { @ @ TARGET};} - (id) initWithCoordinate: (CLLocationCoordinate2D) c {coordinate = c; NSLog (@ "% f% f", c.latitude, c.longitude); own return;} @ App @ implementation Chunaolapsthanmap @SintesCase destinationLabel, StartButton, Acelope, Exhibit, BumbleViewView, BombayEftiView1, BombayEfteview2, Bumblefewview 3, Firebooten; - (BOOL) .UrototettoInterfaceArrayation: (UINPreference Orientation) Interface Orientation {// Returned Orientation for Return Yes Returns (Interface Orientation == UINP Operation Landscape Right); } - (zero) viewDidoad {mapView.mapType = MKMapTypeSatellite; MKCoordinateSpan period; Span.latitudeDelta = 0.2; Span.longitudeDelta = 0.2; CLLocationCoordinate2D location = [auto address space]; Region.span = period; Area.center = location; If (connectivity! = Zero) {[see map delete: annotation: add annotation]; [Add annotation release]; AddNnotation = Zero; } AddAnnotation = [[Patronation Alloc] initWithCoordinate: location]; [See map add symbol: connective]; [Super viewedload]; } - (CLLocationCoordinate2D) address space {NSUserDefaults * prefs = [NSUserDefaults standard user default]; NSString * destinationstring = [prefix objectForcae: @ "address"]; NSString * urlString = [NSString stringWithFormat: @ "http://maps.google.com/maps/geo?q=%@&output=csv", [destination string Stringbadingprrsent Skapuping Encoding: NSUTF8StringEncoding]]; NSString * locationString = [NSString stringWithContentsOfURL: [Ns URL: URLWithString: urlString]]; NSArray * listItems = [locationString Components EspressedBestString: @ ","]; Double latitude = 0.0; Double longitude = 0.0; If ([listItems count]> = 4 && [[listItems objectAtIndex: 0] isEqualToString: @ "200"]) {latitude = [[listItems objectAtIndex: 2] double value]; Longitude = [[List item autandex: 3] double value]; } Else {// show error} CLLocationCoordinate2D location; place. Latitude = latitude; place. Lame = longitude; Return location; } - (MKAnnotationView *) Maps: (MKMapView *) Map ViewFeedback: (ID) Annotation {MKAnnotationView * annView; NIVY = (MKAnette Viv *) [see map Decrement annotation by evidentifier: annotationtitle]; If (annView == blue) annView = [[[Mk Enlightenment VIL Alok] initWithNnotation: annotation re-user: annotation.title] autorelease]; Else annView.annotation = annotation; [Nivu set image: [UIImage imageNamed: @ "target.png"]]; AnnView.canShowCallout = TRUE; Return annually; }  

Please note that I have included only that code, which actually includes mapview. thank you in advanced!

EDIT: I changed the code in my Xcode document for the change in answer 1. I am also lazy to move everything in the above code block, and still, the image is still not there work.

Edit SHOOP DA: Thank you for answering! My solution was that I forgot to say mapView.delegate = self This is so wrong with the code: -)

Before you do address pointer

  @property (nonatomic, assign) a CLLocationCoordinate2D coordination  @property  is not announced;  

In the subtitle you do this:

Back @ "% @", style;

But this is purpose-built and not Python, so you may want to change it:

  return stitle;  

Then your initWithCoordinate is completely wrong. It is better if you do not start Super:

  - (id) initWithCoordinate: (CLLocationCoordinate2D) c {if ((self = [super init]) = zero) {coordinate = c; NSLog (@ "% f,% f", c.latitude, c.longitude); } Healthy return; }  

Try this first thing to see that: -)


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -