jpsim / JPSThumbnailAnnotation

A simple mapkit annotation for displaying images and details.
http://jpsim.com/JPSThumbnailAnnotation
MIT License
473 stars 78 forks source link

Is there a way to programmatically expand the Annotation #6

Closed icodebuster closed 11 years ago

icodebuster commented 11 years ago

I need JPSThumbnailAnnotaion to be in an expanded mode in viewDidLoad. I tried with *setView:(JPSThumbnailAnnotationViewStateExpanded )** but failed.

Code I tried

[annotation setView:JPSThumbnailAnnotationViewStateExpanded];

Error I got

Implicit conversion of 'int' to 'JPSThumbnailAnnotationView *' is disallowed with ARC

Any help appreciated.

sialcasa commented 11 years ago

did you tried to make -(void)expand public and call it directly?

jpsim commented 11 years ago

@sialcasa's solution works.

After making - (void)expand public, here's how you can call it from the demo app included in this repo:

double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
    JPSThumbnailAnnotation *firstAnnotation = mapView.annotations[0];
    [firstAnnotation.view expand];
});

Place this code after [mapView addAnnotations:[self generateAnnotations]];