iphone - How can I center my image in horizontal orientation? -
I have an image view that is inside a UIScrollView so that I can pinch & amp; Zoom My portrait looks fine in portrait mode, but when I go horizontal orientation the image is not centered.
The UIScrollView is 320x460.
Here is my code:
- (zero) viewDidoadload {[Super Viewedload]; CGRact frame = CGRactam (0, 0, 320, 460); Self.imageView = [[[AsyncImageView alloc] initWithFrame: frame] Autoreshoe]; [Self.imageView loadImageFromURL: self.url]; ScrollView.contentSize = CGSizeMake (self.imageView.frame.size.width, self.imageView.frame.size.height); ScrollView.maximumZoomScale = 4.0; ScrollView.minimumZoomScale = 0.75; ScrollView.clipsToBounds = Yes; ScrollView.delegate = self; [ScrollView adsview: self.imageView]; }
and the UIScrollView delegate method
- (UIView *) viewForZoomingInScrollView: (UIScrollView *) scrollView {return imageView; }
How can I focus my image in horizontal orientation?
Try to autorimetry the scroll view:
< Code> scrollview.autoresizingMask = (UIViewAutoresizingFlexibleHyight | UIViewAutoresizingFlexibleWidth);
Comments
Post a Comment