Skip to content

Commit

Permalink
Merge pull request #129 from algrid/fix-120
Browse files Browse the repository at this point in the history
Fix subviews position on orientation change, refs #120
  • Loading branch information
AndrewSB authored Sep 14, 2018
2 parents d3fed8f + d43cb95 commit 18d6109
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ZLSwipeableViewSwift/ViewManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions ZLSwipeableViewSwift/ZLSwipeableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18d6109

Please sign in to comment.