hey
i am new in the iphone development. so i started with an own implementation of the wonderfull app "loopt" to get into the hole thing.
i have one problem with MKAnnotationViews, in the first step i put some AnnotationViews on the map. they represent friends of me.
in a second step i want so update their coordinates, cause my friends move around all the time.
i thought i could use the "dequeueReusableAnnotationViewWithIdentifier" - method for that. and just change or delete this annotation.
but even if i use different "reuseIdentifiers" for every MKAnnotationView, in the second step the Framework does not find an "old" AnnotationView, instead he always creates a new AnnotationView.
My test-method to refresh the coordinates of my friends :
has somebody done that befor ?
thank you very much !
i am new in the iphone development. so i started with an own implementation of the wonderfull app "loopt" to get into the hole thing.
i have one problem with MKAnnotationViews, in the first step i put some AnnotationViews on the map. they represent friends of me.
in a second step i want so update their coordinates, cause my friends move around all the time.
i thought i could use the "dequeueReusableAnnotationViewWithIdentifier" - method for that. and just change or delete this annotation.
but even if i use different "reuseIdentifiers" for every MKAnnotationView, in the second step the Framework does not find an "old" AnnotationView, instead he always creates a new AnnotationView.
Code:
FriendAnnotationView* friendAnnotationView = (FriendAnnotationView*)[googleMap dequeueReusableAnnotationViewWithIdentifier:[friend username]];
if(nil == friendAnnotationView){
friendAnnotationView = [[[FriendAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:[friend username]] autorelease];
}
...
My test-method to refresh the coordinates of my friends :
Code:
- (IBAction) refresh{
FriendsLocationDownloader* friendsDownloader = [[FriendsLocationDownloader alloc] init];
NSArray* friends = [friendsDownloader downloadData];
Friend* friend;
for(int ndx = 0 ; ndx < friends.count ; ndx++){
friend = [friends objectAtIndex:ndx];
NSLog(@"refresh %@", [friend username]);
[self addFriendAnnotationView:friend];
[friend release];
}
}
- (void)addFriendAnnotationView:(Friend*)friend{
FriendAnnotation* annotation = [[[FriendAnnotation alloc] initWithFriend:friend] autorelease];
[googleMap addAnnotation:annotation];
}
has somebody done that befor ?
thank you very much !