Skip to content

Commit

Permalink
Annotation display user image
Browse files Browse the repository at this point in the history
  • Loading branch information
xxd committed Apr 19, 2012
1 parent 7f9af82 commit a0c13c0
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
8 changes: 8 additions & 0 deletions Dandan.xcodeproj/project.pbxproj
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
4D099717153FBD6D00F13D9C /* thumb.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D099716153FBD6D00F13D9C /* thumb.png */; };
4D099722153FE94800F13D9C /* xxd.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D099721153FE94800F13D9C /* xxd.png */; };
4D9B60C2153BF48900E2C5EA /* MyAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D9B60C1153BF48900E2C5EA /* MyAnnotation.m */; };
4D9FDAA615308035001BA076 /* libsqlite3.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9FDAA515308035001BA076 /* libsqlite3.0.dylib */; };
4D9FDAAD1530807C001BA076 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9FDAA81530807C001BA076 /* CFNetwork.framework */; };
Expand Down Expand Up @@ -71,6 +73,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
4D099716153FBD6D00F13D9C /* thumb.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = thumb.png; sourceTree = "<group>"; };
4D099721153FE94800F13D9C /* xxd.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = xxd.png; sourceTree = "<group>"; };
4D9B60C0153BF48900E2C5EA /* MyAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyAnnotation.h; sourceTree = "<group>"; };
4D9B60C1153BF48900E2C5EA /* MyAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyAnnotation.m; sourceTree = "<group>"; };
4D9FDAA515308035001BA076 /* libsqlite3.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.0.dylib; path = usr/lib/libsqlite3.0.dylib; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -347,6 +351,8 @@
9FAD024F151D677500D32564 /* Supporting Files */ = {
isa = PBXGroup;
children = (
4D099721153FE94800F13D9C /* xxd.png */,
4D099716153FBD6D00F13D9C /* thumb.png */,
4DFC30B7153BC20F002E2E02 /* pin.png */,
4DD9471E1532CEC700DAC370 /* dan.sqlite */,
9FAD0274151D700E00D32564 /* Images */,
Expand Down Expand Up @@ -441,6 +447,8 @@
9FAD029E151DA95B00D32564 /* dotLine.png in Resources */,
4DD9471F1532CEC700DAC370 /* dan.sqlite in Resources */,
4DFC30B8153BC20F002E2E02 /* pin.png in Resources */,
4D099717153FBD6D00F13D9C /* thumb.png in Resources */,
4D099722153FE94800F13D9C /* xxd.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
3 changes: 2 additions & 1 deletion Dandan/NewItemViewController.m
Expand Up @@ -353,8 +353,9 @@ - (MKAnnotationView *)mapView:(MKMapView *)aMapView viewForAnnotation:(id <MKAnn
else customPinView.image = [UIImage imageNamed:@"pin.png"];
customPinView.animatesDrop = NO;
customPinView.canShowCallout = YES;
UIImageView *sfIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"xxd.png"]];
customPinView.leftCalloutAccessoryView = sfIconView;
return customPinView;

} else {

pinView.annotation = annotation;
Expand Down
8 changes: 6 additions & 2 deletions Dandan/ParkPlaceMark.h
Expand Up @@ -2,14 +2,18 @@
#import <MapKit/MapKit.h>


@interface ParkPlaceMark : NSObject<MKAnnotation> {
@interface ParkPlaceMark : MKAnnotationView<MKAnnotation> {
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
UIImage *image;
}
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@property (nonatomic, strong) UIImage *image;

-(id)initWithTitle:(NSString *)ttl andCoordinate:(CLLocationCoordinate2D)c2d;
- (id)initWithTitle:(NSString *)ttl andCoordinate:(CLLocationCoordinate2D)c2d;
-(id)initWithCoordinate:(CLLocationCoordinate2D) coordinate;

@end
9 changes: 6 additions & 3 deletions Dandan/ParkPlaceMark.m
@@ -1,12 +1,14 @@
#import "ParkPlaceMark.h"

@implementation ParkPlaceMark
@synthesize title, coordinate;
@synthesize title, subtitle, coordinate;
@synthesize image;

- (id)initWithTitle:(NSString *)ttl andCoordinate:(CLLocationCoordinate2D)c2d {
- (id)initWithTitle:(NSString *)ttl andCoordinate:(CLLocationCoordinate2D)c2d{
[super init];
title = ttl;
title = @"xxd当前位置:";
coordinate = c2d;
subtitle = ttl;
return self;
}

Expand All @@ -15,4 +17,5 @@ -(id)initWithCoordinate:(CLLocationCoordinate2D) c{
NSLog(@"%f,%f",c.latitude,c.longitude);
return self;
}

@end
Binary file added Dandan/thumb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dandan/xxd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a0c13c0

Please sign in to comment.