Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make BottomSheetStyle work like iOS Maps application #110

Open
petec029 opened this issue Dec 13, 2017 · 3 comments
Open

Make BottomSheetStyle work like iOS Maps application #110

petec029 opened this issue Dec 13, 2017 · 3 comments

Comments

@petec029
Copy link

petec029 commented Dec 13, 2017

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

@kevin-lyn
Copy link
Owner

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.

@petec029
Copy link
Author

petec029 commented Dec 15, 2017

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]; } }

@123sunxiaolin
Copy link

@kevin0571 I have the same business requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants