tags:

views:

68

answers:

0

Hi all, I'm a beginner of iPhone development.

I want to move UIImageView position and size when I zoom. I had two image one is main*(map(UIImageView))* for zooming and another is mapPin(UIImageView). I want to place mapPin to original place when i zoom. But mapPin is move to another place not in original position. I create mapPin is with IBOutlet. Here is My code,

- (void)viewDidLoad {
    [super viewDidLoad];

    [scroll setCanCancelContentTouches:NO];
    scroll.indicatorStyle = UIScrollViewIndicatorStyleWhite;
    scroll.clipsToBounds = YES;        

 NSLog(@" Add Img to view,..");
    [scroll setContentSize:CGSizeMake(map.frame.size.width, map.frame.size.height)];

  map.frame.size.height);
 [scroll setZoomScale: 0.2];
 scroll.minimumZoomScale = 1;
    scroll.maximumZoomScale = 5;
    scroll.delegate = self;


 [self layoutScrollImages];
}

that catch zoom end event. that code under UIScrollViewDelegate,

ScrollContentSize is "width-320, height-468";

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale{
 [mapPin  retain];
 NSLog(@"scale %f",scale);

 if (scale == 5) {
  mapPin.center = CGPointMake(1044, 1800);
  NSLog(@"The changing in 5 xscale %f",mapPin.frame.origin.x);
 }
 [scroll setZoomScale:scale+0.01 animated:NO];
    [scroll setZoomScale:scale animated:YES];

 NSLog(@"Zoom End!");
}

Hope Help!. It really beat me.