回到app按钮处理程序 [英] Back to app button handler

查看:104
本文介绍了回到app按钮处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以编程方式将用户发送到设置屏幕后,左上角有一个返回应用按钮:

After programatically sending user to the settings screen, there's a back-to-app button in left upper corner:

点击此按钮可以让用户返回我的应用程序。但是,此时Application调用其委托与我们从后台返回时调用的方法相同:

Tapping this button makes the user go back to my app. However, at that point Application calls its delegate with the same methods that are being called when we get back from background:

applicationWillEnterForeground

applicationDidBecomeActive

同时,我需要通过点击这个特定的返回应用程序按钮来区分用户是否回到应用程序,或者只是在将应用程序发送到后台后输入应用程序以任何其他方式。这有可能吗?

Meanwhile, I need to distinguish whether user came back to the app by tapping this particular "back-to-app" button, or by simply entering the app after sending it to background in any other way. Is this somehow possible?

推荐答案

我相信,默认情况下无法区分。

I believe, there is no way to distinguish by default.

我的建议是,如果您专注于特定的设置条目更改,只需将新设置的值与 applicationDidBecomeActive 中的旧设置值进行比较。如果有变化,那么您可以区分流量。但是,如果没有变化,你就不能。

My suggestion is, if you are focusing for a particular settings entry change, just compare the new setting's value with the old one in the applicationDidBecomeActive. If there is a change, then you can distinguish the flow. However, If there is no change, you can't.

这篇关于回到app按钮处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆