Skip to content

Commit

Permalink
Set delegate to original delegate.
Browse files Browse the repository at this point in the history
  • Loading branch information
kemalbakacak committed Mar 4, 2019
1 parent 55231fc commit 9710562
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/PuiPageViewSegmentedControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ open class PuiPageViewSegmentedControl: PuiSegmentedControl {

public weak var pageViewController: UIPageViewController? {
didSet {

// Set page view delegate
self.pageViewOriginalDelegate = self.pageViewController?.delegate
self.pageViewController?.delegate = self

// Find scroll view
for subview in self.pageViewController?.view.subviews ?? [] {
if let scrollView = subview as? UIScrollView {
// Set scroll view delegate
self.scrollViewOriginalDelegate = scrollView.delegate
scrollView.delegate = self

// Keep scrollview
self.scrollView = scrollView
break
}
Expand Down

0 comments on commit 9710562

Please sign in to comment.