Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-21-2011, 09:08 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 11
uncleunvoid is on a distinguished road
Default MKAnnotation shows it's Custom Marker graphic in simulator but not on device

I had this working very early, but then it stopped and I have no idea why. Here is the code:
Code:
- (void)updateMarkers:(NSMutableArray *)myAudioLocationVOArray
{
 [self cleanupMarkers];

 NSLog(@"UPDATE ALL MARKERS");

 int tArrayCount = [myAudioLocationVOArray count];

 for (int i=0; i< tArrayCount; i = i + 1)
 {
  AudioLocationVO* tAudioLocVO = [myAudioLocationVOArray objectAtIndex:i];

  AudioAnnotation *tNewAnn = [[AudioAnnotation alloc] init];
  tNewAnn.coordinate = CLLocationCoordinate2DMake(tAudioLocVO.latitude, tAudioLocVO.longitude);
  // add current track if available
  tNewAnn.audioLocationVORef = tAudioLocVO;

  [self.mapView addAnnotation:tNewAnn];

  [tNewAnn release];
 }

}

- (void)cleanupMarkers
{
 NSLog(@"REMOVE ALL MARKERS");
 NSArray *tExistingPoints = self.mapView.annotations;
 if ([tExistingPoints count] > 0)
 {
  [self.mapView removeAnnotations:tExistingPoints];
 }
}


- (MKAnnotationView *)mapView:(MKMapView *)myMapView viewForAnnotation:(id <MKAnnotation>)myAnnotation
{

 if ([myAnnotation isKindOfClass:[AudioAnnotation class]])
    {
  AudioAnnotation *tAnnotation = (AudioAnnotation *)myAnnotation;

   MKAnnotationView *tNewMarkerView = [[[MKAnnotationView alloc] initWithAnnotation:tAnnotation reuseIdentifier:nil] autorelease];

   if(tAnnotation.audioLocationVORef.state == ANNOTATION_STATE_DROPPING)
   {
    NSLog(@"ADD DROP MARKER");
    [tNewMarkerView setImage:[UIImage imageNamed:@"greenmarker.png"]];
    tNewMarkerView.draggable = YES;
   }
   else
   {
    NSLog(@"ADD NEW MARKER");
    [tNewMarkerView setImage:[UIImage imageNamed:@"newMarker.png"]];
    tNewMarkerView.draggable = NO;
   }

   tNewMarkerView.frame = CGRectMake(tNewMarkerView.frame.origin.x,tNewMarkerView.frame.origin.y,20,26);

   tNewMarkerView.canShowCallout = YES;
   tNewMarkerView.enabled = YES;


   // callout button
   UIButton *tButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
   tNewMarkerView.rightCalloutAccessoryView = tButton;


   // cover art and title/subtitle
   UIButton *tCover = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
   if(tAnnotation.audioLocationVORef.trackVO==nil)
   {
    tAnnotation.title = @"Drop a Track";
    tAnnotation.subtitle = @"Choose a track to drop";
    [tCover setImage:[UIImage imageNamed:@"preCover.png"] forState:UIControlStateNormal];
   }
   else
   {
    tAnnotation.title = tAnnotation.audioLocationVORef.trackVO.songTitle;
    tAnnotation.subtitle = tAnnotation.audioLocationVORef.trackVO.artist;

    NSLog(@"ADD DATA MARKER %@", tAnnotation.title);
    if(tAnnotation.audioLocationVORef.state==ANNOTATION_STATE_DROPPING){
     tAnnotation.subtitle = @"Touch submit to Drop";
    }
    [tCover setImage:[tAnnotation.audioLocationVORef.trackVO getCoverArt] forState:UIControlStateNormal];
   }
   // make cover enabled to see song detail?
   tCover.enabled = NO;

   tNewMarkerView.leftCalloutAccessoryView = tCover;

   [tCover release];

  return tNewMarkerView;
 }
 return nil;

}
I tried to delete and add again the graphics as assets. I have been playing around a bit with the frame property. So far no luck.

And why the difference between simulator and device. I am using SDK 4.2... on iPhone 4.
uncleunvoid is offline   Reply With Quote
Old 01-21-2011, 09:25 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 11
uncleunvoid is on a distinguished road
Default

AAAARG:

Yep it was the upper-lower case issue. damn that buggered me for about a week. Trick was I had one named markerA and one markerb, because I had them in different states, I checked in the folder and the names were markera and markerB, which as a mind trick made me believe the file names are fine. By checking the third time, I realized where the mix up was. They should really make the simulator as sensistive.
uncleunvoid is offline   Reply With Quote
Reply

Bookmarks

Tags
annotation, custom, device, mapkit, simulator

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 358
10 members and 348 guests
7twenty7, dre, iAppDeveloper, jeroenkeij, Mah6447, Morrisone, sacha1996, Sami Gh, stanny, toon4413
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:41 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0