Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavigationController backButtonImage location #970

Closed
MattKiazyk opened this issue Nov 16, 2017 · 6 comments
Closed

NavigationController backButtonImage location #970

MattKiazyk opened this issue Nov 16, 2017 · 6 comments

Comments

@MattKiazyk
Copy link
Contributor

When subclassing NavigationController and overriding the backButtonImage the back image isn't fully left aligned..should it?

screenshot 2017-11-16 16 05 05

You'll see the small space on the left before the toolbar. Can I set that so that there is no space?

I fully understand the space around the image for the pulse animation, but more talking about the left/right side of whole toolbar

class AppNavigationController: NavigationController {
    open override func prepare() {
        super.prepare()

        guard let v = navigationBar as? NavigationBar else {
            return
        }
        v.backgroundColor = UIColor.black
        v.tintColor = UIColor.white
        v.backButtonImage = Icon.cm.arrowBack?.tint(with: .white)
    }

Thanks!

@MattKiazyk
Copy link
Contributor Author

Further read into it and looks like an iOS 11 issue with navigationBars in the way they are implemented internally:

https://forums.developer.apple.com/thread/80075
https://stackoverflow.com/questions/44677018/ios-11-uinavigationbar-bar-button-items-alignment/46660888#46660888

@yasirmturk
Copy link

try this in prepare()
if let navBar = navigationBar as? NavigationBar { navBar.contentEdgeInsetsPreset = .none }

@MattKiazyk
Copy link
Contributor Author

Unfortunately that still doesn't work @yasirmturk - still leaves a 8 pt margin on left/right sides

screenshot 2017-11-17 08 05 07

@daniel-jonathan
Copy link
Member

@yasirmturk is correct. This is an iOS 11 issue and I have tried many times to fix it without the best results. I will give it another try, so I will this up for now. Thank you!

@intoxicated
Copy link
Contributor

intoxicated commented Mar 14, 2018

@DanielDahan this should be fixed with with #1038

@daniel-jonathan
Copy link
Member

Correct, we can close this. Thank you @intoxicated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants