Skip to content

Commit

Permalink
Remove setting
Browse files Browse the repository at this point in the history
  • Loading branch information
wangmchn committed Apr 21, 2016
1 parent 59b9649 commit df184a2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
*.zip

# CocoaPods
#
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4D45BF621CC7BC12003F0151"
BuildableName = "WMPageControllerSwiftFramework.framework"
BuildableName = "WMPageControllerSwift.framework"
BlueprintName = "WMPageControllerSwiftFramework"
ReferencedContainer = "container:WMPageController-Swift.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -46,7 +46,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4D45BF621CC7BC12003F0151"
BuildableName = "WMPageControllerSwiftFramework.framework"
BuildableName = "WMPageControllerSwift.framework"
BlueprintName = "WMPageControllerSwiftFramework"
ReferencedContainer = "container:WMPageController-Swift.xcodeproj">
</BuildableReference>
Expand All @@ -64,7 +64,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4D45BF621CC7BC12003F0151"
BuildableName = "WMPageControllerSwiftFramework.framework"
BuildableName = "WMPageControllerSwift.framework"
BlueprintName = "WMPageControllerSwiftFramework"
ReferencedContainer = "container:WMPageController-Swift.xcodeproj">
</BuildableReference>
Expand Down
20 changes: 15 additions & 5 deletions WMPageController-Swift/PageController/PageController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ public class PageController: UIViewController, UIScrollViewDelegate, MenuViewDel
public lazy var titleColorNormal = UIColor.blackColor()
public lazy var menuBGColor = UIColor(red: 244.0/255.0, green: 244.0/255.0, blue: 244.0/255.0, alpha: 1.0)

override public var edgesForExtendedLayout: UIRectEdge {
didSet {
hasInit = false
viewDidLayoutSubviews()
}
}

// MARK: - Private vars
private var memoryWarningCount = 0
private var viewHeight: CGFloat = 0.0
Expand Down Expand Up @@ -131,8 +138,6 @@ public class PageController: UIViewController, UIScrollViewDelegate, MenuViewDel

override public func viewDidLoad() {
super.viewDidLoad()
edgesForExtendedLayout = UIRectEdge.None
UIApplication.sharedApplication().delegate?.window??.backgroundColor = .whiteColor()
view.backgroundColor = .whiteColor()
guard childControllersCount > 0 else { return }
calculateSize()
Expand Down Expand Up @@ -300,18 +305,23 @@ public class PageController: UIViewController, UIScrollViewDelegate, MenuViewDel
}

private func calculateSize() {
var navBarHeight = (navigationController != nil) ? CGRectGetMaxY(navigationController!.navigationBar.frame) : 0
if edgesForExtendedLayout == UIRectEdge.None {
navBarHeight = 0
}

if viewFrame == CGRectZero {
viewWidth = view.frame.size.width
viewHeight = view.frame.size.height - menuHeight
viewHeight = view.frame.size.height - menuHeight - navBarHeight
} else {
viewWidth = viewFrame.size.width
viewHeight = viewFrame.size.height
viewHeight = viewFrame.size.height - menuHeight
}
if showOnNavigationBar && (navigationController?.navigationBar != nil) {
viewHeight += menuHeight
}
viewX = viewFrame.origin.x
viewY = viewFrame.origin.y
viewY = viewFrame.origin.y + navBarHeight
childViewFrames.removeAll()
for index in 0 ..< childControllersCount {
let viewControllerFrame = CGRect(x: CGFloat(index) * viewWidth, y: 0, width: viewWidth, height: viewHeight)
Expand Down

0 comments on commit df184a2

Please sign in to comment.