当我致电UIApplication.shared.setStatusBarOrientation(.landscapeRight, animated: true)
app进入后台并返回,打印
“ApplicationWillResignActive”
“ApplicationDidBecomeActive”
“ApplicationWillResignActive”
“ApplicationDidBecomeActive”
为什么?我只有两个动作@objc fileprivate func handleApplicationWillResignActive() {
debugPrint("ApplicationWillResignActive")
if self.playerPlayStatus == .playing {
self.currentPlayTime = self.player.currentTime()
self.player.pause()
}
}
@objc fileprivate func handleApplicationDidBecomeActive() {
debugPrint("ApplicationDidBecomeActive")
switch self.playerPlayStatus {
case .pause:
self.player.seek(to: self.currentPlayTime, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero, completionHandler: { (finished) in
if finished {
self.player.play()
}
})
default: break
}
}
答案 0 :(得分:0)
ApplicationWillResignActive和Background都是不同的东西。即使在前台应用程序中的应用程 请详细说明,你想做什么?