STPopup
STPopup copied to clipboard
Make BottomSheetStyle work like iOS Maps application
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.
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.
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]; } }
@kevin0571 I have the same business requirement.