I have a UIScrollView. Inside this UIScrollView is a UIView which contains every other child views (including a UIButton). It has the same bounds as the UIScrollView.
I want:
- The bottom of the UIScrollView is not scroll-able (where the UIButton is placed).
- The UIButton is responsive.
So I set the bottom of the UIScrollView a little higher than the UIVIew as below image:
This will make the UIButton not responsive (it's responsive in the left layout). Any suggestion? Thanks!
Some part of my code:
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectZero];
[self addSubview:self.scrollView];
self.scrollContent = [[UIView alloc] initWithFrame:CGRectZero];
[self.scrollView addSubview:self.scrollContent];
self.button = [UIButton buttonWithType:UIButtonTypeCustom];
[self.scrollContent addSubview:self.button];
[self.button addTarget:self
action:@selector(buttonPressed)
forControlEvents:UIControlEventTouchUpInside];
Update:
Looks like the right way is to keep the bottom of the scroll view and set its contentSize, but since I'm using autolayout, I found that the height of the contentSize is always zero???