2
votes

When I set UIScrollView clipsToBounds property to NO, it allowed me to display the content views horizontally outside its bound. That is what I wanted to achieve. But it also allowed to scroll pass top and bottom bounds which I do not want.

Can UIScrollView clipsToBounds be applied vertically only?

(btw: I want to effect just as in the picture so I do not want to expand the content view horizontally.)

enter image description here

1
Why do you want it to draw outside its bounds? - Wain
@Wain: problem solved, - user523234

1 Answers

3
votes

One solution would be to embed scroll view inside another view, which would have clipToBounds = NO, while scroll view would have clipToBounds = YES and width equal to content beign displayed.

As I am not good with images, I try example by code:

wrapperView.frame = CGRectMake(0, 0, 300, 300);
wrapperView.clipToBounds = NO;

scrollView.frame = CGRectMake(0, 0, 400, 300);
scrollView.clipToBounds = YES
[wrapperView addSubview:scrollView];

contentView.frame= CGRectMake(0, 0, 400, 1234); 
[scrollView addSubview:contentView];