Material: Switch in toolbar acting weird

Created on 5 Oct 2016  路  4Comments  路  Source: CosmicMind/Material

I've converted my project to Swift3, and updated Material to version 2.0.
It's seems like almost everything went smooth except the Switch controller when it set inside the Navigation Controller.

First the initial position is wrong, and when rotating the device it seems like the Switch controller width property grows bigger.

Here's my setup:

fileprivate func prepareSwitchControl() {
        switchControl = Switch(state: .off, style:.light, size: .medium)
        switchControl.delegate = self
}

fileprivate func prepareNavigationItem() {
        navigationItem.title = "Hello"
        navigationItem.titleLabel.textColor = .white
        navigationItem.titleLabel.textAlignment = .left
        navigationItem.leftViews = [menuButton]
        navigationItem.rightViews = [switchControl, searchButton]
 }

You could also reproduce this problem by editing the NavigationController or ToolbarController demo project; change the starButton to Switch.

help wanted

All 4 comments

Thank you for reporting this. I will take a look. I am about to hop on a plane, so once I have a stable connection, I will get back to you.

Taking a look at this now :)

Hey! Material 2.1.1 should fix the issue :) Thank you for bringing this to our attention.

Awesome!, Thank you @danieldahan, and you're welcome.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alvincrisuy picture alvincrisuy  路  6Comments

davidevincenzi picture davidevincenzi  路  5Comments

timoschwarzer picture timoschwarzer  路  4Comments

ohgodno picture ohgodno  路  4Comments

aleufms picture aleufms  路  6Comments