#import "mapImageView.h"
@implementation mapImageView
#define MAPWIDTH 1688
#define MAPHEIGHT 1125
@synthesize contentView;
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame])
{
contentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
//background imageLayer mountains
UIImage* bg = [UIImage imageNamed:@"map_bg.png"];
UIImageView* bgView = [[UIImageView alloc] initWithImage:bg];
[contentView addSubview:bgView];
[bgView release];
[bg release];
[self addSubview:contentView];
self.contentSize = CGSizeMake(MAPWIDTH, MAPHEIGHT);
self.scrollEnabled = TRUE;
self.bounces = FALSE;
//self.scrollIndicatorInsets = UIEdgeInsetsMake(50, 0, 0, 0);
self.bouncesZoom = FALSE;
self.minimumZoomScale = 0.285;
self.maximumZoomScale = 1.0;
self.delegate = self;
[self scrollRectToVisible:CGRectMake(250, 0, 480, 100) animated:NO];
}
return self;
}
- (UIView*)viewForZoomingInScrollView:(UIScrollView*)scrollView
{
return contentView;
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
{
//set the scrolling bounds
self.contentSize = CGSizeMake(MAPWIDTH*scale, MAPHEIGHT*scale);
NSLog(@"scale: %f", scale);
NSLog(@"content width: %f", self.contentSize.width);
NSLog(@"content height: %f", self.contentSize.height);
NSLog(@"frame width %f", contentView.frame.size.width);
NSLog(@"frame height %f", contentView.frame.size.height);
}
- (void)dealloc
{
[contentView release];
[super dealloc];
}
@end