Skip to content

Commit

Permalink
Merge branch 'release/1.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
msaps committed Apr 11, 2017
2 parents b5dbcc9 + b9e02f8 commit 1bcb633
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Example/Pageboy-Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
D681E3541E549F7E007C08F5 /* PageViewControllerAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = D681E3531E549F7E007C08F5 /* PageViewControllerAppearance.swift */; };
D681E3561E54ABE8007C08F5 /* TransparentNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = D681E3551E54ABE8007C08F5 /* TransparentNavigationBar.swift */; };
D6ECCEC61E51B6FB00E9D5B3 /* ChildViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6ECCEC51E51B6FB00E9D5B3 /* ChildViewController.swift */; };
E8F663AB1E9C387D00F601AC /* NavigationControllerUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8F663AA1E9C387D00F601AC /* NavigationControllerUtils.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -71,6 +72,7 @@
D681E3531E549F7E007C08F5 /* PageViewControllerAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageViewControllerAppearance.swift; sourceTree = "<group>"; };
D681E3551E54ABE8007C08F5 /* TransparentNavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransparentNavigationBar.swift; sourceTree = "<group>"; };
D6ECCEC51E51B6FB00E9D5B3 /* ChildViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChildViewController.swift; sourceTree = "<group>"; };
E8F663AA1E9C387D00F601AC /* NavigationControllerUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationControllerUtils.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -140,6 +142,7 @@
D681E3531E549F7E007C08F5 /* PageViewControllerAppearance.swift */,
D681E3501E54959B007C08F5 /* GradientView.swift */,
D681E3551E54ABE8007C08F5 /* TransparentNavigationBar.swift */,
E8F663AA1E9C387D00F601AC /* NavigationControllerUtils.swift */,
);
name = "Example Components";
sourceTree = "<group>";
Expand Down Expand Up @@ -247,6 +250,7 @@
D681E3541E549F7E007C08F5 /* PageViewControllerAppearance.swift in Sources */,
D681E3511E54959B007C08F5 /* GradientView.swift in Sources */,
D6ECCEC61E51B6FB00E9D5B3 /* ChildViewController.swift in Sources */,
E8F663AB1E9C387D00F601AC /* NavigationControllerUtils.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
19 changes: 19 additions & 0 deletions Example/Pageboy-Example/NavigationControllerUtils.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// NavigationControllerUtils.swift
// Pageboy-Example
//
// Created by Merrick Sapsford on 10/04/2017.
// Copyright © 2017 Merrick Sapsford. All rights reserved.
//

import UIKit

extension UINavigationController {

open override var preferredStatusBarStyle: UIStatusBarStyle {
if let rootViewController = self.viewControllers.first {
return rootViewController.preferredStatusBarStyle
}
return super.preferredStatusBarStyle
}
}
2 changes: 1 addition & 1 deletion Pageboy.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Pod::Spec.new do |s|
s.platform = :ios, "9.0"
s.requires_arc = true

s.version = "1.0.1"
s.version = "1.0.2"
s.summary = "A simple, highly informative page view controller."
s.description = <<-DESC
A page view controller that provides simplified data source management, enhanced delegation and other useful features.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Pageboy/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<string>1.0.2</string>
<key>CFBundleVersion</key>
<string>AUTO_GENERATED</string>
<key>NSPrincipalClass</key>
Expand Down
24 changes: 23 additions & 1 deletion Sources/Pageboy/PageboyViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ open class PageboyViewController: UIViewController {
internal var pageViewController: UIPageViewController!
internal var previousPagePosition: CGFloat?
internal var expectedTransitionIndex: Int?

//
// MARK: Properties
//
Expand All @@ -122,6 +122,22 @@ open class PageboyViewController: UIViewController {
}
}

/// Preferred status bar style of the current view controller.
open override var preferredStatusBarStyle: UIStatusBarStyle {
if let currentViewController = self.currentViewController {
return currentViewController.preferredStatusBarStyle
}
return super.preferredStatusBarStyle
}

/// Preferred status bar hidden of the current view controller.
open override var prefersStatusBarHidden: Bool {
if let currentViewController = self.currentViewController {
return currentViewController.prefersStatusBarHidden
}
return super.prefersStatusBarHidden
}

/// The object that is the data source for the page view controller. (Defaults to self)
public weak var dataSource: PageboyViewControllerDataSource? {
didSet {
Expand Down Expand Up @@ -183,6 +199,10 @@ open class PageboyViewController: UIViewController {
public internal(set) var currentIndex: Int? {
didSet {
guard let currentIndex = self.currentIndex else { return }

UIView.animate(withDuration: 0.3) {
self.setNeedsStatusBarAppearanceUpdate()
}

// ensure position keeps in sync
self.currentPosition = CGPoint(x: self.navigationOrientation == .horizontal ? CGFloat(currentIndex) : 0.0,
Expand All @@ -193,6 +213,7 @@ open class PageboyViewController: UIViewController {
didScrollToPageAtIndex: currentIndex,
direction: direction,
animated: self.isScrollingAnimated)

}
}

Expand Down Expand Up @@ -341,6 +362,7 @@ internal extension PageboyViewController {
pageViewController.dataSource = self
self.pageViewController = pageViewController

self.addChildViewController(pageViewController)
self.view.addSubview(pageViewController.view)
pageViewController.view.pageboyPinToSuperviewEdges()
self.view.sendSubview(toBack: pageViewController.view)
Expand Down

0 comments on commit 1bcb633

Please sign in to comment.