检测“的攻丝”;触按可返回至通话“;在iOS中
有没有办法检测用户是否点击“触摸返回呼叫”()按钮?可能是某种委托方法,或是类似于检测“的攻丝”;触按可返回至通话“;在iOS中,ios,swift,callkit,Ios,Swift,Callkit,有没有办法检测用户是否点击“触摸返回呼叫”()按钮?可能是某种委托方法,或是类似于应用程序中的参数(u2;:didFinishLaunchingWithOptions:) 只需在callKit viewcontroller类中输入此代码,并通过点击“触摸返回呼叫”检查用户何时返回应用程序。当您返回应用程序时,即使您没有点击“触摸返回呼叫”,也会始终调用此代码。(例如,点击应用程序图标)您是否找到了解决方案? class ViewController: UIViewController {
应用程序中的参数(u2;:didFinishLaunchingWithOptions:)
只需在callKit viewcontroller类中输入此代码,并通过点击“触摸返回呼叫”检查用户何时返回应用程序。当您返回应用程序时,即使您没有点击“触摸返回呼叫”,也会始终调用此代码。(例如,点击应用程序图标)您是否找到了解决方案?
class ViewController: UIViewController {
private var observer: NSObjectProtocol?
override func viewDidLoad() {
super.viewDidLoad()
observer = NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: .main) { [unowned self] notification in
// do whatever you want when the app is brought back to the foreground
}
}
}