Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xcuserstate
*.xcworkspacedata

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
Podfile.lock
Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
2 changes: 1 addition & 1 deletion Demo/JPSThumbnailAnnotation-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
1,264 changes: 924 additions & 340 deletions Demo/JPSThumbnailAnnotation.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Demo/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'

target 'JPSThumbnailAnnotation' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!

# Pods for JPSThumbnailAnnotation
pod 'JPSThumbnailAnnotation', :path => '../'

end
14 changes: 13 additions & 1 deletion Demo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,21 @@ - (NSArray *)annotations {
ottawa.coordinate = CLLocationCoordinate2DMake(45.43f, -75.70f);
ottawa.disclosureBlock = ^{ NSLog(@"selected Ottawa"); };

// Web Image Example
// Seattle Space Needle Building
JPSThumbnail *spaceNeedle = [[JPSThumbnail alloc] init];
NSString *stringUrl = @"https://upload.wikimedia.org/wikipedia/commons/2/23/Space_Needle_2011-07-04.jpg"; // Non-squared big image
spaceNeedle.imageUrl = [NSURL URLWithString:stringUrl]; // Set web image from url
spaceNeedle.contentMode = UIViewContentModeScaleAspectFit; // Set image Aspect to see all image
spaceNeedle.title = @"Space Needle";
spaceNeedle.subtitle = @"Seattle Landmark";
spaceNeedle.coordinate = CLLocationCoordinate2DMake(47.6205f, -122.3493f);
spaceNeedle.disclosureBlock = ^{ NSLog(@"selected Space Needle"); };

return @[[JPSThumbnailAnnotation annotationWithThumbnail:empire],
[JPSThumbnailAnnotation annotationWithThumbnail:apple],
[JPSThumbnailAnnotation annotationWithThumbnail:ottawa]];
[JPSThumbnailAnnotation annotationWithThumbnail:ottawa],
[JPSThumbnailAnnotation annotationWithThumbnail:spaceNeedle]];
}

#pragma mark - MKMapViewDelegate
Expand Down
2 changes: 2 additions & 0 deletions JPSThumbnailAnnotation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Pod::Spec.new do |s|

s.description = 'JPSThumbnailAnnotation is a simple mapkit annotation view for displaying images with clean design and animations.'

s.ios.deployment_target = '7.0'
s.source_files = 'JPSThumbnailAnnotation/*.{h,m}'
s.frameworks = 'QuartzCore', 'MapKit', 'CoreLocation'
s.requires_arc = true
s.dependency 'SDWebImage'
end
1 change: 1 addition & 0 deletions JPSThumbnailAnnotation/JPSThumbnail.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ typedef void (^ActionBlock)();
@interface JPSThumbnail : NSObject

@property (nonatomic, strong) UIImage *image;
@property (nonatomic, strong) NSURL *imageUrl;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
Expand Down
15 changes: 14 additions & 1 deletion JPSThumbnailAnnotation/JPSThumbnailAnnotationView.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@import QuartzCore;
#import "JPSThumbnailAnnotationView.h"
#import "JPSThumbnail.h"
#import <SDWebImage/UIImageView+WebCache.h>

NSString * const kJPSThumbnailAnnotationViewReuseID = @"JPSThumbnailAnnotationView";

Expand Down Expand Up @@ -138,7 +139,19 @@ - (void)updateWithThumbnail:(JPSThumbnail *)thumbnail {
self.coordinate = thumbnail.coordinate;
self.titleLabel.text = thumbnail.title;
self.subtitleLabel.text = thumbnail.subtitle;
self.imageView.image = thumbnail.image;
if(thumbnail.imageUrl){
[self.imageView setIndicatorStyle:UIActivityIndicatorViewStyleGray];
[self.imageView setShowActivityIndicatorView:YES];
[self.imageView sd_setImageWithURL:thumbnail.imageUrl
placeholderImage:thumbnail.image
options:SDWebImageAllowInvalidSSLCertificates
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
[self.imageView setShowActivityIndicatorView:NO];
}];
}
else{
self.imageView.image = thumbnail.image;
}
self.disclosureBlock = thumbnail.disclosureBlock;
self.imageView.contentMode = thumbnail.contentMode;
}
Expand Down