3

I opened the app from a backgrounded state to see the achievements nav bar button in the wrong position.

Nav Bar Button

(Sorry, no freehand circle since I'm on mobile)

This could be an issue with the button itself (are you using a UIBarButtonItem with a custom view?), or a UIKit bug, since I can't reliably reproduce it.

  • App Version: 1.6.1.2
  • Device: iPhone 6
  • OS Version: Version 9.3.4 (Build 13G35)
  • 1
    The actual problem is that the +10 (or any other rep gain) is not shown. – Glorfindel Dec 5 '16 at 7:28
  • @Glorfindel Oh I guess that's right, it didn't even occur to me that this was due to rep gain. – JAL Dec 5 '16 at 7:32
  • You can do freehand circles on iOS just by editing in Photos btw (unless that's new in iOS 10? Can't remember...) – Cai Dec 5 '16 at 10:03
3

Update

Fixed in 1.6.2.5.

So, this used to be a random occurrence and now it's happening a lot. It looks like the bug occurs when updating the UIBarButtonItem in viewWillDisappear:

I'm fixing this by 1. also clearing the achievements in viewDidAppear: so there's a high probability that no changes will occur in viewDidDisappear: and 2. Moving things to a custom view that has a fixed height so there's only one axis which things can be off on. Without the first fix, things look correct once popping has finished but buttons are in the wrong spot during the animation.


Previously

This is an iOS bug which we're probably hitting due to the weird way we do things.

When there are no achievements, the right navigation item looks like this:

[Inbox (image)]-[Fixed-Space = 0]-[Achievements (image)]

When a rep change comes in (say +5), the following happens:

  1. A custom view is added to the achievements view as customView.
  2. If the width of that view is less than the width of the image (42pt), the difference is added to the the fixed space item so Inbox doesn't move.
[Inbox (image)]-[Fixed-Space = 5]-[Achievements (custom)]

This causes the achievements bar button to be further right than it was with the image. The fact that the +5 label is also shorter causes it to be lower than the image would be as well.

I suspect that under certain conditions when transitioning from the custom view to the image, the navigation bar isn't getting properly laid out, causing the image's origin to be down and to the right of where it should be.

Since I can't reliably reproduce this, and I'm hesitant to throw extra setNeedsLayout calls onto a UINavigationBar to try to blindly fix this, I'm just gonna leave it alone for now.

| improve this answer | |
  • Thanks for the detailed response, I wonder if there is a radar open for this issue, we can't be the only ones experiencing it. – JAL Dec 8 '16 at 5:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .