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

为啥要单独使用一个topViewNum变量来判断UI的显示隐藏? #2

Closed
gsm958708323 opened this issue Mar 8, 2024 · 4 comments

Comments

@gsm958708323
Copy link

image
是否可以通过栈来判断,打开UI时,取出栈顶UI,如果不是弹窗,则隐藏并调用OnPause,新界面入栈,显示并调用OnResume
关闭UI时,取出栈顶UI,如果不是弹窗,显示并调用OnResume

@Skierhou
Copy link
Owner

Skierhou commented Mar 8, 2024

这个int32的作用实际上就是栈,入栈+1,出栈-1

@gsm958708323
Copy link
Author

不是已经有一个栈的结构了吗,为什么还要单独弄一个topViewNum来记录栈的行为

@Skierhou
Copy link
Owner

那个栈用来管理的是这一层所有界面,里面包含弹窗界面和全屏界面,这里的topViewNum表示的是当前界面上面还有多少全屏界面,有一些区别,不过只用那个栈也是能可以处理的,不能确保关闭界面的一定是栈顶界面,如果目前界面有A,B,C,D,当关闭的为B时,需要先判断当前显示的全屏界面是不是B,是的话从栈顶A往下刷新显示,直到遇见新的全屏界面为止,都可以把,只是栈里面这样操作会麻烦点,然后我就重新加了个新字段,这样只要关闭或打开就循环所有层级比它低的设置一下状态,这样看起来直观点把。

@gsm958708323
Copy link
Author

感谢大佬解答疑惑

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