Skip to content

Instantly share code, notes, and snippets.

@rodericj
Created April 10, 2010 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodericj/362334 to your computer and use it in GitHub Desktop.
Save rodericj/362334 to your computer and use it in GitHub Desktop.
#import "CSImageAnnotationView.h"
#import "CSMapAnnotation.h"
#define kHeight 100
#define kWidth 100
#define kBorder 2
@implementation CSImageAnnotationView
@synthesize imageView = _imageView;
- (id)initWithAnnotation:(id )annotation reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
self.frame = CGRectMake(0, 0, kWidth, kHeight);
self.backgroundColor = [UIColor whiteColor];
CSMapAnnotation* csAnnotation = (CSMapAnnotation*)annotation;
UIImage* image = [UIImage imageNamed:csAnnotation.userData];
_imageView = [[UIImageView alloc] initWithImage:image];
_imageView.frame = CGRectMake(kBorder, kBorder, kWidth - 2 * kBorder, kWidth - 2 * kBorder);
[self addSubview:_imageView];
return self;
}
-(void) dealloc
{
[_imageView release];
[super dealloc];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment