Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jpsim/jpsthumbnailannotation
A simple mapkit annotation for displaying images and details.
https://github.com/jpsim/jpsthumbnailannotation
Last synced: 5 days ago
JSON representation
A simple mapkit annotation for displaying images and details.
- Host: GitHub
- URL: https://github.com/jpsim/jpsthumbnailannotation
- Owner: jpsim
- License: mit
- Created: 2013-04-22T06:27:08.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-01-15T12:50:07.000Z (about 8 years ago)
- Last Synced: 2025-01-12T05:08:08.313Z (12 days ago)
- Language: Objective-C
- Homepage: http://jpsim.com/JPSThumbnailAnnotation
- Size: 848 KB
- Stars: 473
- Watchers: 32
- Forks: 78
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# JPSThumbnailAnnotation
JPSThumbnailAnnotation is a simple mapkit annotation view for displaying images with clean design and animations. It is 100% programmatically drawn and styled for iOS 7.
![JPSThumbnailAnnotation in action](screenshots2.jpg)
## Installation
### From CocoaPods
Add `pod 'JPSThumbnailAnnotation'` to your Podfile.
### Manually
Copy the `JPSThumbnailAnnotation` folder to your Xcode project and link the `MapKit`, `QuartzCore` and `CoreLocation` libraries.
## Usage
(see sample Xcode project in `/Demo`)
You add an `JPSThumbnailAnnotation` just like any other `MKAnnotation`. The annotations take in a `JPSThumbnail` object to display an image, title, subtitle at a specific coordinate. You can also set a block to be run when the disclosure button is tapped.
``` objc
JPSThumbnail *thumbnail = [[JPSThumbnail alloc] init];
thumbnail.image = [UIImage imageNamed:@"empire.jpg"];
thumbnail.title = @"Empire State Building";
thumbnail.subtitle = @"NYC Landmark";
thumbnail.coordinate = CLLocationCoordinate2DMake(40.75f, -73.99f);
thumbnail.disclosureBlock = ^{ NSLog(@"selected Empire"); };[mapView addAnnotation:[JPSThumbnailAnnotation annotationWithThumbnail:thumbnail]];
```### Usage notes
Make sure the mapView implements the following 3 MKMapViewDelegate methods:
``` objc
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {
if ([view conformsToProtocol:@protocol(JPSThumbnailAnnotationViewProtocol)]) {
[((NSObject *)view) didSelectAnnotationViewInMap:mapView];
}
}- (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view {
if ([view conformsToProtocol:@protocol(JPSThumbnailAnnotationViewProtocol)]) {
[((NSObject *)view) didDeselectAnnotationViewInMap:mapView];
}
}- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation {
if ([annotation conformsToProtocol:@protocol(JPSThumbnailAnnotationProtocol)]) {
return [((NSObject *)annotation) annotationViewInMap:mapView];
}
return nil;
}
```## License
MIT Licensed.