• Stars
    star
    475
  • Rank 89,355 (Top 2 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple mapkit annotation for displaying images and details.

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

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.

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:

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {
    if ([view conformsToProtocol:@protocol(JPSThumbnailAnnotationViewProtocol)]) {
        [((NSObject<JPSThumbnailAnnotationViewProtocol> *)view) didSelectAnnotationViewInMap:mapView];
    }
}

- (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view {
    if ([view conformsToProtocol:@protocol(JPSThumbnailAnnotationViewProtocol)]) {
        [((NSObject<JPSThumbnailAnnotationViewProtocol> *)view) didDeselectAnnotationViewInMap:mapView];
    }
}

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
    if ([annotation conformsToProtocol:@protocol(JPSThumbnailAnnotationProtocol)]) {
        return [((NSObject<JPSThumbnailAnnotationProtocol> *)annotation) annotationViewInMap:mapView];
    }
    return nil;
}

License

MIT Licensed.

More Repositories

1

SourceKitten

An adorable little framework and command line tool for interacting with SourceKit.
Swift
2,275
star
2

Yams

A Sweet and Swifty YAML parser.
C
1,067
star
3

PeerKit

An open-source Swift framework for building event-driven, zero-config Multipeer Connectivity apps
Swift
869
star
4

CardsAgainst

An iOS game for horrible people
Swift
572
star
5

ZenTuner

A minimal chromatic tuner for iOS & macOS.
Swift
513
star
6

DeckRocket

DeckRocket turns your iPhone into a remote for Deckset presentations
Objective-C
398
star
7

JPSVolumeButtonHandler

JPSVolumeButtonHandler provides an easy block interface to hardware volume buttons on iOS devices. Perfect for camera apps!
Objective-C
331
star
8

SwiftEdit

A proof-of-concept editor, written in Swift, that supports Swift syntax highlighting using SourceKit.
Swift
235
star
9

AWSPics

An AWS CloudFormation stack to run a serverless password-protected photo gallery
JavaScript
217
star
10

Milestones

An app to count down the days until upcoming milestones.
Swift
199
star
11

JPSImagePickerController

A pixel-perfect clone of iOS 7's UIImagePickerController, with a few improvements.
Objective-C
157
star
12

JPSKeyboardLayoutGuide

Easily make your Auto Layout view controllers keyboard aware
Objective-C
69
star
13

SwiftXPC

XPC simplified for Swift. Deal with Swift and NS* objects instead of xpc_object_t.
Swift
63
star
14

Mix2Files

iOS Project to mix several audio files (mp3's, m4a's, caf's) together at different intervals
Objective-C
40
star
15

LetterpressPlayer

Solves Letterpress games via OCR and colour categorization. Work in progress.
Objective-C
37
star
16

talks

Slides for a few of the talks I've given
JSONiq
35
star
17

UICollectionView-Animation-Bug

There's a confirmed bug in UICollectionView. This project highlights a workaround.
Objective-C
33
star
18

jekyll_app_site

Small Jekyll template to present an iPhone app with a static site
CSS
24
star
19

JPSDisplayLink

JPSDisplayLink provides an easy block interface to CADisplayLink-based animations.
Objective-C
23
star
20

AudioEmailer

Very small iOS app to record, playback and email audio. Includes a realtime dB level meter using F3
Objective-C
23
star
21

pod-diffs

Guide and example for a neat way to modify pods using patchfiles
Objective-C
22
star
22

MPCMultipeerClient

Wrapper around MultipeerConnectivity to simplify common use cases
Objective-C
15
star
23

swiftlint-bazel-example

Example SwiftLint integration with custom native rules using Bazel
Starlark
13
star
24

SwiftIvarTypeDetector

Print out the type encoding for properties in a Swift class
Objective-C
12
star
25

Selfish

A tool to automatically insert explicit `self` references in the Swift files in the current directory.
Swift
8
star
26

retest

Re-run failed GitHub Workflow runs on PRs by commenting "/retest".
TypeScript
5
star
27

rust-ios-bazel-demo

A demo iOS app building with Bazel, Rust and Swift
C++
4
star
28

PCCanvas

Simple drawing canvas for core graphics. Easily accepts PaintCode code.
Objective-C
4
star
29

SwiftClassTodo

Todo example from Swift class
Swift
4
star
30

advent-of-code-2021

Swift
3
star
31

Vertigrow-iPad

iPad app I built for Vertigrow a long time ago to help them mockup living walls as a sales tool. Basic image dragging app.
Objective-C
3
star
32

node-docker

Demo Node.JS App using Docker
Shell
3
star
33

laptop

Laptop is a shell script that turns your Mac OS X laptop into an awesome development machine.
Shell
2
star
34

AutoLayoutHelpers

Super space saving auto layout helpers.
Objective-C
2
star
35

rules_xcodeproj_ios_app

Sample rules_xcodeproj iOS app
Starlark
2
star
36

jpsim.github.com

My personal website
Ruby
2
star
37

presto-gem

Gem for interacting with Presto cards.
Ruby
2
star
38

cocoapods-static-xcframework-issue

Issue with CocoaPods and static xcframeworks
Ruby
2
star
39

InputClick

The most barebones project ever with the simplest implementation of the UIInputViewAudioFeedback protocol.
Objective-C
2
star
40

GoogleMapsSDKBugs

Swift
2
star
41

SwiftPMUtilityExample

Swift
2
star
42

fastmac

Shell
1
star
43

retest-action

A GitHub Action to re-run failed GitHub workflow runs on pull requests
TypeScript
1
star
44

applebugs

Collection of sample code for radars I've filed
Objective-C
1
star
45

presto_api

REST API for interacting with Presto cards using the presto ruby gem
Ruby
1
star
46

SourceKit

Swift Package Manager package for SourceKit
Swift
1
star