ios - How do I vertically center a UIImageView in a UIScrollView programmatically? -


i have view controller puts uiimageview inside uiview wrapper put uiscrollview. need image zoomed out , centered vertically.

the view controller instantiated , presented within 600x600 uipopovercontroller.

this code have view controller:

- (void) loadview {     uiimageview *imageview = [[uiimageview alloc]initwithimage:self.image];     uiscrollview *scrollview = [[uiscrollview alloc] initwithframe:imageview.frame];        scrollview.delegate = self;     scrollview.bounces = no;      self.containerview = [[uiview alloc] initwithframe:imageview.frame];       [self.containerview addsubview:imageview];      [scrollview addsubview:self.containerview];     scrollview.minimumzoomscale = .4;     scrollview.maximumzoomscale = 5.0;     [scrollview setzoomscale:.4];       self.view = scrollview;  } - (uiview *)viewforzoominginscrollview:(uiscrollview *)scrollview {     return self.containerview; } 

i've tried bunch of things center it, appears @ top of scroll view.

use contentsize , contentoffset uiscrollview


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -