Skip to content
This repository has been archived by the owner on Jun 17, 2018. It is now read-only.

No menu background color on device rotation #267

Open
piv199 opened this issue Aug 30, 2016 · 2 comments
Open

No menu background color on device rotation #267

piv199 opened this issue Aug 30, 2016 · 2 comments

Comments

@piv199
Copy link

piv199 commented Aug 30, 2016

  • Expected behavior and actual behavior.

Actual behavior

screen shot 2016-08-30 at 13 43 12
screen shot 2016-08-30 at 13 45 23

Expected behavior: The whole menu view to be blue color as well, so no white space while rotating the device.

  • Steps to reproduce the problem.

The first I've done a small configuration:

Configuration

private struct PagingMenuOptions: PagingMenuControllerCustomizable {

    private var componentType: ComponentType {
        return .All(menuOptions: MenuOptions(), pagingControllers: pagingControllers)
    }

    private var pagingControllers: [UIViewController] {
        return [SignInViewController(), SignUpViewController()]
    }

}

private struct MenuOptions: MenuViewCustomizable {
    var displayMode: MenuDisplayMode {
        return .SegmentedControl
    }

    private var height: CGFloat {
        return ez.screenOrientation.isPortrait ? 90.0 : 64.0
    }

    private var backgroundColor: UIColor {
        return UIColor(r: 16, g: 66, b: 101)
    }

    private var selectedBackgroundColor: UIColor {
        return UIColor(r: 16, g: 66, b: 101)
    }

    private var focusMode: MenuFocusMode {
        return .Underline(height: 4.0,
                          color: UIColor(r: 229, g: 238, b: 245),
                          horizontalPadding: 0,
                          verticalPadding: 0)
    }

    var itemsOptions: [MenuItemViewCustomizable] {
        return [SignInMenuItem(), SignUpMenuItem()]
    }

    private struct SignInMenuItem: MenuItemViewCustomizable {
        var displayMode: MenuItemDisplayMode {
            return .Text(title: MenuItemText(text: "Sign In",
                color: UIColor(white: 1.0, alpha: 0.52),
                selectedColor: UIColor.whiteColor()))
        }
    }

    private struct SignUpMenuItem: MenuItemViewCustomizable {
        var displayMode: MenuItemDisplayMode {
            return .Text(title: MenuItemText(text: "Sign Up",
                color: UIColor(white: 1.0, alpha: 0.52),
                selectedColor: UIColor.whiteColor()))
        }
    }
}

Then in viewDidLoad I added setup of paging menu:

        navigationController?.navigationBarHidden = true
        pagingMenuController = PagingMenuController(options: PagingMenuOptions())
        addChildViewController(pagingMenuController)
        view.addSubview(pagingMenuController.view)
        pagingMenuController.didMoveToParentViewController(self)

Also I added rotate notification, thus I need different height for portrait and landscape. When orientation changes I call setup again:

pagingMenuController.setup(PagingMenuOptions())

This PagingMenuOptions are stick to orientation mode:

    private var height: CGFloat {
        return ez.screenOrientation.isPortrait ? 90.0 : 64.0
    }

But when rotating the device, there is white space, if I'm going from landscape to portrait one.

  • Specifications like the version of the project, library, or Swift.

PagingMenuController (1.1.2), Swift 2.3

@kitasuke
Copy link
Owner

kitasuke commented Oct 9, 2016

Changing options value is not supported yet which might cause this issue.
I'm working on it now.

@kitasuke
Copy link
Owner

kitasuke commented Oct 9, 2016

pagingMenuController.setup(options) method should be called explicitly if you want to change option value for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants