iOS 7, corrupt UINavigationBar when swiping back fast using the default interactivePopGestureRecognizer

前端 未结 3 1842
我寻月下人不归
我寻月下人不归 2021-01-31 02:50

I have an issue that I\'m stuck on, but I have no idea why it even happens; If I push a detail controller on the stack, and I swipe back very quickly using the default left edge

3条回答
  •  轮回少年
    2021-01-31 03:31

    After investigating this issue for some time with debug console, Instruments and Reveal, I have found out the following:

    1) On simulator the bug can be recreated every time, if using Profile/Automation Template and adding the following script:

    var target = UIATarget.localTarget();
    var appWindow = target.frontMostApp().mainWindow();
    appWindow.buttons()[0].tap();
    target.delay(1);
    target.flickFromTo({x:2, y: 100}, {x:160, y: 100});
    

    2) On real device (iPhone 5s, iOS 7.1) this script never causes the bug. I tried various options for flick coordinates and the delay.

    3) UINavigationBar consists of:

    _UINavigationBarBackground (doesn't seem to be related to the bug)
          _UIBackdropView
               _UIBackgropEffectView
               UIView
          UIImageView
    UINavigationItemView
          UILabel (visible in the bug)
    _UINavigationBarBackIndicatorView (visible in the bug)
    

    4) When bug happens UILabel looks half transparent and in the wrong position, but the actual properties of the UILabel are correct (alpha: 1 and frame as in normal situation). Also _UINavigationBarBackIndicatorView looks doesn't correspond to actual properties - it is visible although it's alpha is 0.

    From this I conclude that it's a bug of Simulator and that you can't even detect from the code that something is wrong.

    So @troop231 - are you 100% sure this also happens on device?

提交回复
热议问题