IIS7 Rewrite
IIS7 Rewrite

Reputation: 799

UIImageView inside UIScrollView bleeding over next page

I have a UIScrollView and a UIPageControl with 5 pages. Each page is set at a different background color. Each page is 1024 x 768 and only landscape mode is supported and the content size is set to: scrollView.contentSize = CGSizeMake(1024 * 5, 768);

Each page shows the right background color with the right size.

I place a UIImageView on each page which I can move around. From page 2 onward (or index 1), if the image is moved to the left age and onward it bleeds over to the previous page, you can actually go to the previous page and see part of the image there.

The same however does not happen for the right edge. If the image is moved past the viewable area, you don't see the image on the next page.

My question is how is this possible and what can I do to prevent it?

Thank you in advance

Upvotes: 0

Views: 158

Answers (1)

IIS7 Rewrite
IIS7 Rewrite

Reputation: 799

After much playing with this, to help others that may run into the same situation, the answer to this problem is to set:

self.view.clipsToBounds = TRUE;

on the view where your UIImageView(s) are added as a subview. For me, each page was an instantiation of a UIViewController class with the view set to the bounds of the window.

Upvotes: 1

Related Questions