app crashes when handling navbar button event

后端 未结 2 427
不思量自难忘°
不思量自难忘° 2021-01-20 16:42

In my app, I have a navbar button that allows the user to pop back to the top of the navigation stack. This has been there for a while and has been working fine. However,

相关标签:
2条回答
  • 2021-01-20 17:12

    Quick question, but I ask this because I did this to myself several times, the reference to your View, it isn't locally scoped in your Main's method by chance, is it? What happens is that the reference is lost but the screen still appears but then as soon as you want to do something it's been garbage collected.

    The Back button is owned by the navigation controller itself, which would have been referenced likely by your Window, and therefore it can really through you off.

    0 讨论(0)
  • 2021-01-20 17:17

    Just as a quick reminder, I had a similar crash when not the button was created on a local variable but the view containing the button. I've described the solution here.

    0 讨论(0)
提交回复
热议问题