Hi All,
Haven't been on here recently, but would like a little help in managing an image in a scrollview.
I have the following code:
What I'm trying to figure out is a way I can centre the image when the window first appears. IB allows you to offset the image in the view, but this is permanent, which is not what I want. ONce the person moves the image or zooms in or out, it can stay where it is. [I'm feeling this is more complicated than I have done before, but willing to learn, if that's the case.]
Any help is much appreciated.
Haven't been on here recently, but would like a little help in managing an image in a scrollview.
I have the following code:
Code:
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.jpg"]];
self.imageView = tempImageView;
[tempImageView release];
scrollView.contentSize = CGSizeMake(imageView.frame.size.width, imageView.frame.size.height);
scrollView.maximumZoomScale = 1;
scrollView.minimumZoomScale = 0.5;
scrollView.clipsToBounds = YES;
scrollView.delegate = self;
[scrollView addSubview:imageView];
}
What I'm trying to figure out is a way I can centre the image when the window first appears. IB allows you to offset the image in the view, but this is permanent, which is not what I want. ONce the person moves the image or zooms in or out, it can stay where it is. [I'm feeling this is more complicated than I have done before, but willing to learn, if that's the case.]
Any help is much appreciated.