Skip to content

Commit 18d6109

Browse files
authored
Merge pull request #129 from algrid/fix-120
Fix subviews position on orientation change, refs #120
2 parents d3fed8f + d43cb95 commit 18d6109

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ZLSwipeableViewSwift/ViewManager.swift

+7
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ class ViewManager : NSObject {
173173
removeBehavior(snapBehavior)
174174
}
175175

176+
func resnapView() {
177+
if case .snapping(_) = state {
178+
unsnapView()
179+
state = snappingStateAtContainerCenter()
180+
}
181+
}
182+
176183
fileprivate func attachView(toPoint point: CGPoint) {
177184
anchorView.center = point
178185
anchorView.backgroundColor = UIColor.blue

ZLSwipeableViewSwift/ZLSwipeableView.swift

+3
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ open class ZLSwipeableView: UIView {
117117
override open func layoutSubviews() {
118118
super.layoutSubviews()
119119
containerView.frame = bounds
120+
for viewManager in viewManagers.values {
121+
viewManager.resnapView()
122+
}
120123
}
121124

122125
// MARK: Public APIs

0 commit comments

Comments
 (0)