Skip to content

Commit

Permalink
Merge branch 'release/2.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
tungvoduc committed Feb 28, 2019
2 parents 688dfa3 + c5bfb07 commit ada7eda
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -12,6 +12,8 @@ build/
*.perspectivev3
!default.perspectivev3
xcuserdata/
Example/DTPagerController.xcworkspace/xcshareddata/
Example/Pods/Pods.xcodeproj/xcshareddata/
*.xccheckout
profile
*.moved-aside
Expand Down
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

2 changes: 1 addition & 1 deletion DTPagerController.podspec
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'DTPagerController'
s.version = '2.0.2'
s.version = '2.0.3'
s.summary = 'A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.'
s.swift_version = '4.2'

Expand Down
31 changes: 14 additions & 17 deletions DTPagerController/Classes/DTPagerController.swift
Expand Up @@ -6,7 +6,7 @@
//
//

import Foundation
import UIKit

/// PagerViewControllerDelegate
@objc public protocol DTPagerControllerDelegate: NSObjectProtocol {
Expand Down Expand Up @@ -227,19 +227,15 @@ open class DTPagerController: UIViewController, UIScrollViewDelegate {
setUpScrollIndicator()
}

open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}

//MARK: Segmented control action
// MARK: Segmented control action
@objc func pageSegmentedControlValueChanged() {
//Call delegate method before changing value
delegate?.pagerController?(self, willChangeSelectedPageIndex: selectedPageIndex, fromPageIndex: previousPageIndex)

let oldViewController = viewControllers[previousPageIndex]
let newViewController = viewControllers[selectedPageIndex]

if automaticallyHandleAppearanceTransitions {
if self.automaticallyHandleAppearanceTransitions {
oldViewController.beginAppearanceTransition(false, animated: true)
newViewController.beginAppearanceTransition(true, animated: true)
}
Expand All @@ -260,21 +256,22 @@ open class DTPagerController: UIViewController, UIScrollViewDelegate {
self.setNeedsStatusBarAppearanceUpdate()

}, completion: { (finished) -> Void in
// Call these two methods to notify that two view controllers are already removed or added to container view controller (Check Documentation)
if self.automaticallyHandleAppearanceTransitions {
oldViewController.removeFromParent()
newViewController.didMove(toParent: self)

oldViewController.endAppearanceTransition()
newViewController.endAppearanceTransition()
}

//Call delegate method after changing value
self.delegate?.pagerController?(self, didChangeSelectedPageIndex: self.selectedPageIndex)
})

//Setting up new previousPageIndex for next change
previousPageIndex = selectedPageIndex
// Call these two methods to notify that two view controllers are already removed or added to container view controller (Check Documentation)
if automaticallyHandleAppearanceTransitions {
oldViewController.removeFromParent()
newViewController.didMove(toParent: self)

oldViewController.endAppearanceTransition()
newViewController.endAppearanceTransition()
}

// Setting up new previousPageIndex for next change
previousPageIndex = selectedPageIndex
}

// Remove all current child view controllers
Expand Down
21 changes: 0 additions & 21 deletions Example/DTPagerController/ViewController.swift
Expand Up @@ -22,27 +22,6 @@ class ViewController: UIViewController {
super.viewDidLoad()
view.addSubview(scrollView)
view.addSubview(button)
// Do any additional setup after loading the view, typically from a nib.
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print("viewWillAppear")
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
print("viewWillDisappear")
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
print("viewDidAppear")
}

override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
print("viewDidDisappear")
}

override func didReceiveMemoryWarning() {
Expand Down

0 comments on commit ada7eda

Please sign in to comment.