diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..da63089 Binary files /dev/null and b/.DS_Store differ diff --git a/Example/Use Code/.DS_Store b/Example/Use Code/.DS_Store new file mode 100644 index 0000000..2f9b51e Binary files /dev/null and b/Example/Use Code/.DS_Store differ diff --git a/PageController/MenuItem.swift b/PageController/MenuItem.swift index 4c6a526..320a703 100644 --- a/PageController/MenuItem.swift +++ b/PageController/MenuItem.swift @@ -79,7 +79,8 @@ class MenuItem: UILabel { private func setup() { textAlignment = NSTextAlignment.Center userInteractionEnabled = true - backgroundColor = UIColor.clearColor() +// backgroundColor = UIColor.clearColor() + backgroundColor = .redColor() } override func touchesEnded(touches: Set, withEvent event: UIEvent?) { diff --git a/PageController/MenuView.swift b/PageController/MenuView.swift index f6ea2db..f1d0708 100644 --- a/PageController/MenuView.swift +++ b/PageController/MenuView.swift @@ -29,12 +29,15 @@ public class MenuView: UIView, MenuItemDelegate { override public var frame: CGRect { didSet { guard contentView != nil else { return } +// FIXME: - reset contentView's x will cause a bug that contentView won't start from x: 0, remove them and works! +// /** // Make the contentView center, because system will change menuView's frame if it's a titleView. if (contentView.frame.origin.x + contentView.frame.width / 2) != (bounds.origin.x + bounds.width / 2) { var contentFrame = contentView.frame contentFrame.origin.x = bounds.origin.x - (contentFrame.width - bounds.width) / 2 contentView.frame = contentFrame } +// */ } } public var leftView: UIView? { diff --git a/StoryboardExample/.DS_Store b/StoryboardExample/.DS_Store new file mode 100644 index 0000000..14e8bf6 Binary files /dev/null and b/StoryboardExample/.DS_Store differ diff --git a/StoryboardExample/StoryboardExample/Base.lproj/Main.storyboard b/StoryboardExample/StoryboardExample/Base.lproj/Main.storyboard index 1202ad4..02f2822 100644 --- a/StoryboardExample/StoryboardExample/Base.lproj/Main.storyboard +++ b/StoryboardExample/StoryboardExample/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -82,6 +82,7 @@ + diff --git a/StoryboardExample/StoryboardExample/ParentController/CustomPageController.swift b/StoryboardExample/StoryboardExample/ParentController/CustomPageController.swift index 5cc8fc2..a646308 100644 --- a/StoryboardExample/StoryboardExample/ParentController/CustomPageController.swift +++ b/StoryboardExample/StoryboardExample/ParentController/CustomPageController.swift @@ -18,15 +18,16 @@ class CustomPageController: PageController { delegate = self preloadPolicy = PreloadPolicy.Neighbour menuViewContentMargin = 10 + showOnNavigationBar = true } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. - menuView?.leftView = customButtonWithTitle("Left") - menuView?.rightView = customButtonWithTitle("Right") - +// menuView?.leftView = customButtonWithTitle("Left") + menuView?.rightView = customButtonWithTitle("+") + menuView?.backgroundColor = .yellowColor() let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(5.0 * Double(NSEC_PER_SEC))) dispatch_after(delayTime, dispatch_get_main_queue()) { self.vcTitles = ["Test", "Test", "Test", "Test", "Test", "Test"]