PagingMenuController icon indicating copy to clipboard operation
PagingMenuController copied to clipboard

No menu background color on device rotation

Open piv199 opened this issue 9 years ago • 2 comments

  • 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

piv199 avatar Aug 30 '16 13:08 piv199

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

kitasuke avatar Oct 09 '16 22:10 kitasuke

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

kitasuke avatar Oct 09 '16 22:10 kitasuke