在iOS中轻按“触摸以返回通话”

问题描述 投票:0回答:1

是否可以检测用户是否轻按了“触摸返回通话”(https://i.stack.imgur.com/9m9xi.jpg)?可能是某种委托方法,或类似application(_:didFinishLaunchingWithOptions:)

中的参数
ios swift callkit
1个回答
0
投票
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
        }
    }
}

只需在您的callKit viewcontroller类中使用此代码,然后通过点按“触摸以返回通话”来检查用户何时返回应用程序即可

© www.soinside.com 2019 - 2024. All rights reserved.