IOS – Alipay (9.9.2) home page scroll

The company’s app interactive classmates had a similar Alipay home page, the heart is really tired, in line with the objective attitude towards the pursuit of technology, I would imitate Alipay make a page.
personal blog:

A Alipay page design.
IOS - Alipay (9.9.2) home page scroll
IOS - Alipay (9.9.2) home page scroll

can be found in the figure = = = = difficulties following

  1. The gesture needs to be transmitted, and the upper part of the slide is sliding into the lower half.
  2. The UI needs to change, when it slides up, the top part shrinks.

= = = = solution

IOS - Alipay (9.9.2) home page scroll
  1. Accept gesture information received by a screen size UIScrollView (A). The responder is the lower half of a UIScrollView (B). This can be achieved by clicking anywhere on the screen, sliding parts are UIScrollView (B).
  2. The problem is, since only the following UIScrollView mobile, how to do the above also move together. Here is a silly way to listen to the following UIScrollView (B) contentOffset changes, and then control the display of some of the content.
  3. There is a pit, move up UIScrollView (B) on the part of the content decreased gradually, but UIScrollView (B) frame constant, i.e. UIScrollView (B) or in this position, but it looks like it is UIScrollView (B) is also moving up. Thus, the UIScrollView (B) can be set to NO clipsToBounds. In this way, the part beyond the frame can still be displayed.
  4. Now it seems that the effect is satisfied, but we will certainly find out the part of the frame can not respond to the event ah! This time you can rewrite the system comes with
    – (UIView *) hitTest: (CGPoint) point withEvent: (UIEvent *) method to solve this problem.

= = = = key code

  1. Solve the problem of hand gestures
Remove the original scrollViewA / / gesture NSMutableArray *list = [NSMutableArray arrayWithArray:scrollViewA.gestureRecognizers]; for (UIGestureRecognizer *gestureRecognizer in list) {[scrollViewA removeGestureRecognizer:gestureRecognizer];} / / scrollViewB gestures to scrollViewA for (UIGestureRecognizer *gestureRecognizer in scrollViewB.gestureRecognizers) {[scrollViewA addGestureRecognizer:gestureRecognizer];}

2 solve the problem of head view and the following scrollViewB rolling together, use the KVO to monitor the contentOffset changes directly.
3 beyond the scrollViewB section can click

- (UIView) hitTest: (CGPoint) point withEvent: (UIEvent * event) {for (UIView *subview in [self.subviews reverseObjectEnumerator] CGPoint [subview convertPoint:point) {convertedPoint = fromView:self]; UIView = *hitTestView [subview hitTest:convertedPoint withEvent:event]; if (hitTestView) {return}} return [super hitTestView; hitTest:point withEvent:event];}
Two. Our company’s app palm medical registration home page 2


IOS - Alipay (9.9.2) home page scroll
2016-09-21 17_42_35.gif

As part of more complex content = more than a scrollViewB but similar, or a key part of the above code, the code is not posted is not exposed, colleagues to see svn==