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

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -