Note that there are some explanatory texts on larger screens.

plurals
  1. POUIScrollView - Zooming problems (Cuts off the bottom of UIView inside UIScrollView after any zooming)
    primarykey
    data
    text
    <p>So a little explanations of what my view is doing before the problem, the page loads a bunch of buttons that are clickable into the contentView which is a subView of my scrollView.</p> <p>i got a UIViewController, inside i have my UIScrollView scrollView to handle the scrolling and zooming UIView contentView which i add all the UIButtons to.</p> <p>Alright i'll try to only put the code which i believe might need to be changed.</p> <p>in viewDidLoad</p> <pre><code>scrollView.contentSize = CGSizeMake(320, (20+totalRows*OFFSET_Y) ); [scrollView setMaximumZoomScale:4]; [scrollView setMinimumZoomScale:1]; [scrollView setDelegate:self]; [contentView setFrame:CGRectMake(0, 0, 320, (20+totalRows*OFFSET_Y) )]; [self.scrollView addSubview:contentView]; </code></pre> <p>Doing some calculation to see how big i need to content size to be to fit all the buttons, then i add the contentView as subView to my scrollView. I then add all the UIButtons as subview of my contentView</p> <pre><code>- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return [self contentView]; } </code></pre> <p>Got my delegate method for zooming returning the contentView.</p> <p>Ok so everything is scrollable and zoomable like it should be..all my UIButtons are still clickable and works how it should be.</p> <p>The problem is after i zoom in/out when i scroll all the way to the bottom of my scrollView it's being cut off from the bottom, so the last row of buttons are being cut in half. even when i rezoom to 1:1 it's still cut off.</p> <p>I've got a NavigationController in the app which is 44 pixels, not sure if that's screwing something up somehow.</p> <p>I was checking the contentSize of the scrollView and contentView and before any zooming is done, the Height of my scrollView is 44 pixels bigger than the contentView, but after any zooming the ratio is 1:1 and that seems to be the problem. I'm not changing the size anywhere in the code though.</p> <p>Any help is appreciated! Thanks</p> <hr> <p>Like i thought before I added this piece of code</p> <pre><code>- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale (float)scale { self.scrollView.contentSize = CGSizeMake(self.scrollView.contentSize.width, self.scrollView.contentSize.height + (44 * scale)); } </code></pre> <p>And now Zooming doesn't cut anything off and seems to be working correctly.</p> <p>I still don't believe this is what I should have to do but I guess it works for now.</p> <p>Still hoping someone has a better answer! </p> <hr> <p>After playing more with my app I realized that the zooming was never the problem to begin with. The actual problem was with my UIView *contentView. After changing the background colour of my scrollView and my contentView (to 2 very diff colours) I noticed that my contentView wasn't long enough to cover all of the buttons.</p> <p>So at first load the scrollView was big enough to see everything but once you zoom and it takes the size of the contentView it wasn't being adjusted properly!</p> <p>All that to say, it finally works how it should!..haha no replies but hopefully someone might find this useful! Best tip was to change the background colours.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload