STPopup icon indicating copy to clipboard operation
STPopup copied to clipboard

Make BottomSheetStyle work like iOS Maps application

Open petec029 opened this issue 6 years ago • 3 comments

I would like to be able to pull up the view by a handle and have it snap in place to a partial and full view like the iOS Maps application. Including making the view scrollup to the max height when you swipe up from anywhere and then having the tableview start scrolling once you have reached the max height.

img_1432

img_1433

petec029 avatar Dec 13 '17 21:12 petec029

One potential way to achieve this is:

  • set opacity of background view of STPopupController to 0 by default;
  • handle touch move event of "handle" view; adjust the height of content size of view controller and opacity of background view of STPopupController.

I haven't tried this personally, not sure if it will work as expected.

kevin-lyn avatar Dec 14 '17 15:12 kevin-lyn

Thanks Kevin. Is there a way to makes these changes without modifying the STPopUpViewController itself? To add the draggable handle and necessary events so swiping up anywhere on the subclassed tableviewcontroller drags the view up until it reaches max height and then the tableview would scroll.

And override or bypass the nav bars touchDidEndWithOffset which handles the drag up /down behavior of the view controller

- (void)popupNavigationBar:(STPopupNavigationBar *)navigationBar touchDidEndWithOffset:(CGFloat)offset { if (offset > 150) { STPopupTransitionStyle transitionStyle = self.transitionStyle; self.transitionStyle = STPopupTransitionStyleSlideVertical; [self dismissWithCompletion:^{ self.transitionStyle = transitionStyle; }]; } else { [_containerView endEditing:YES]; [UIView animateWithDuration:0.4 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ _containerView.transform = CGAffineTransformIdentity; } completion:nil]; } }

petec029 avatar Dec 15 '17 15:12 petec029

@kevin0571 I have the same business requirement.

123sunxiaolin avatar Jul 03 '20 11:07 123sunxiaolin