app crashes when handling navbar button event

后端 未结 2 455
不思量自难忘°
不思量自难忘° 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.

提交回复
热议问题