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

Old navigationItem remains when leftBarButtonItem is set without title and sloppy-swiper cancelled #22

Open
inamiy opened this issue May 29, 2017 · 2 comments

Comments

@inamiy
Copy link

inamiy commented May 29, 2017

Hi!

This could be an UIKit bug (that is hard to fix), but I noticed an awkward navigationItem behavior as I wrote reproducing code below:

[Example] Reproduce navigationItem bug when leftBarButtonItem is set without title and sloppy-swiper cancelled

Step to reproduce

  1. Set left & right barButtonItems WITHOUT title.
  2. Push a new ViewController.
  3. Sloppy-swipe-back, but cancel it (don't pop).
  4. Sloppy-swipe-back to pop.
  5. RootViewController's navigationItem remains on navigationBar.

NOTE

Bug won't reproduce if...

  1. leftBarButtonItem is not set, or
  2. title is set

Is there any workaround or fixes for this problem? (One idea might be to add a dummy transparent text 😵)
Thanks!

@inamiy
Copy link
Author

inamiy commented May 29, 2017

OK, I just solved it by adding empty titleView as follows:

if (self.navigationItem.title == nil && self.navigationItem.titleView == nil) {
    self.navigationItem.titleView = [[UIView alloc] init];
}

@fastred
Copy link
Owner

fastred commented May 29, 2017

Thanks for posting a workaround and a sample code! I think this may be a bug in SloppySwiper. I haven't used it with a custom leftBarButtonItem.

I'd investigate the logic in https://github.com/fastred/SloppySwiper/blob/master/Classes/SloppySwiper.m#L82-L107. There's also this separate issue (when not using SloppySwiper) that may be somehow related: http://holko.pl/ios/2014/04/06/interactive-pop-gesture/

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

No branches or pull requests

2 participants