diff --git a/ZLSwipeableViewSwift/ViewManager.swift b/ZLSwipeableViewSwift/ViewManager.swift index 2674f39..dda72e5 100644 --- a/ZLSwipeableViewSwift/ViewManager.swift +++ b/ZLSwipeableViewSwift/ViewManager.swift @@ -173,6 +173,13 @@ class ViewManager : NSObject { removeBehavior(snapBehavior) } + func resnapView() { + if case .snapping(_) = state { + unsnapView() + state = snappingStateAtContainerCenter() + } + } + fileprivate func attachView(toPoint point: CGPoint) { anchorView.center = point anchorView.backgroundColor = UIColor.blue diff --git a/ZLSwipeableViewSwift/ZLSwipeableView.swift b/ZLSwipeableViewSwift/ZLSwipeableView.swift index de4a344..1791897 100644 --- a/ZLSwipeableViewSwift/ZLSwipeableView.swift +++ b/ZLSwipeableViewSwift/ZLSwipeableView.swift @@ -117,6 +117,9 @@ open class ZLSwipeableView: UIView { override open func layoutSubviews() { super.layoutSubviews() containerView.frame = bounds + for viewManager in viewManagers.values { + viewManager.resnapView() + } } // MARK: Public APIs